I need a SPARQL query to get all available inverse properties. exp (before, after, spouse, ... etc) i tried this, on specific domain (Person) :
SELECT
DISTINCT ?predicate
WHERE
{
?subject a dbo:Person .
?object a dbo:Person .
?subject ?predicate ?object .
?object ?predicate ?subject .
}
RESULT:
- http://www.w3.org/2000/01/rdf-schema#seeAlso
- http://www.w3.org/2002/07/owl#sameAs
- http://www.w3.org/2002/07/owl#differentFrom
- http://dbpedia.org/property/deathPlace
- http://dbpedia.org/ontology/associatedBand
- http://dbpedia.org/ontology/author
- http://dbpedia.org/ontology/associatedMusicalArtist
- http://dbpedia.org/ontology/field
- http://dbpedia.org/ontology/governor
- http://dbpedia.org/ontology/lastAppearance
- http://dbpedia.org/ontology/managerClub
- http://dbpedia.org/ontology/recordLabel
- http://dbpedia.org/ontology/relation
- http://dbpedia.org/ontology/related
- http://dbpedia.org/ontology/relative
- http://dbpedia.org/ontology/starring
- http://dbpedia.org/property/p
- http://dbpedia.org/property/title
- http://purl.org/linguistics/gold/hypernym
Note that you're not asking for the inverse properties; you're asking for symmetric (or reciprocal, or reflective) properties -- where each subject/object pair is also described as an object/subject pair.
If you really want something closer to inverse, you might try something like --
SELECT DISTINCT ?predicate
?reverse_predicate
WHERE
{
?subject a dbo:Person .
?object a dbo:Person .
?subject ?predicate ?object .
?object ?reverse_predicate ?subject .
}
ORDER BY ?predicate ?reverse_predicate
-- but if you look at the results from that query, you'll notice that many "reflected" relationships are not expressed with properties that are actually the inverse of each other.
ex:child
and ex:parent
are probably easily understood as inverse -- but how about ex:sibling
, ex:brother
, ex:sister
? Also note just how many "reflected" properties there are for, for instance, <http://dbpedia.org/ontology/child>!
Probably, describing why you need these, and how you plan to make use of them, will help others provide more relevant answers or other information...