Discuss Inverse properties
Talk pages on this wiki should primarily be used to address possible mistakes as well as missing and superseded information in the documentation.
In case you are seeking support concerning individual questions, please have a look at this page. The Semantic MediaWiki user mailing list is always a good idea for seeking help.
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
very nice rewrite | 4 | 09:22, 13 June 2014 |
Rewrite of this page | 0 | 00:02, 8 February 2014 |
Perhaps another useful way to explain this important feature is to contrast that
- a non-inverse predicate returns pages that have the named page-property, that is, subjects of a triple
- an inverse predicate returns pages referenced by the named page-property, that is, objects of a triple
Please note, I used the term "inverse predicate" not "inverse property" because there may be confusion with owl:inverseProperty relations, that is, it's more technically correct to reference the operation of resolving predicates than it is to reference a property per se. This general comment might affect for instance how the first sentence is worded from "The inverse of a property simply is the property that points into the other direction." to
- A query, composed of predicates, normally returns pages having a certain property. An 'inverse predicate' is simply an expression that returns pages referenced by a certain property. This feature (indicated by a hyphen in a predicate expression) only applies to queries, not to annotations for a page.
- For example, ...
I know it may be a pain, but if you agree that 'inverse predicates' is better, then I'd suggest the page title should be changed in accordance with this terminology.
Second, it'd be great to provide an example of what is meant by "It is strongly suggested not to create property pages that are called like inverse properties (it won't destroy anything, but it might create unnecessary confusion)."
Finally the last sentence is a bit confusing: I don't see how an inverse predicate works for text values. So, instead of "currently only supported if they are of Type:Page" how about "is only supported for page properties" ?
thanks.
Heiya John, I agree that this page should be worked on. It should be easier to grasp what it is all about. I am however not so sure about renaming this to predicate though I understand your point, at least I think I do. :) Cheers
Introduction[edit]
The inverse of a property simply is the property that points into the other direction. For example, if "developer of" connects a person to a software tool, then the inverse of "developer of" connects software tools to persons. So far, it was very hard to use properties in other directions. In our example, you could, e.g., have an ask query showing the all persons who develop some open source tool, but you could not have a query that shows all software tools that are developed by people living in Argentina. To do the latter, you would have had to use a property "is developed by" that explicitly connects software tools to their developers, and you would have had to add data for that again. If you need both directions, you would have to maintain both properties individually, which is not very convenient.
Feature Details[edit]
SMW (SVN) now allows you to directly refer to the inverse of any property by simply putting a "-" in front of its name. For example, "-developer of" gives you access to what I called "is developed by" above. This can be used in any place where property names occur, including browsing special pages, ask queries, and output directives of queries. So the projects developed by people from Argentina can be obtained with a query
{{#ask: [[-developer of:: <q>[[lives in::Argentina]]</q> ]] }} or simply
{{#ask: [[-developer of.lives in::Argentina]] }}
If applicable, inverse properties generally are linked to the page of the
corresponding property (so "-developer of" links to "Property:developer of").
It is strongly suggested not to create property pages that are called like
inverse properties (it won't destroy anything, but it might create unnecessary
confusion). Also, you cannot use inverse properties to enter semantic data
into the wiki: all annotations must be on the page that is the subject of the
non-inverted property.
Inverses in queries are currently only supported if they are of Type:Page.
See this thread