Finding Instances of a Type

Top  Previous  Next

SPARQL uses the special RDF predicate URL xxx to find the type of an item. Our implementation uses the same predicate. The predicate maps the instance (as the subject) to the type(s) of that instance (as the object) in the triple pattern. So to find all topics of type person, the following query can be used:

SELECT ?p WHERE { ?p xxx <http://psi.networkedplanet.com/types/person> }

To find all of the types of a specific topic, it is only necessary to make the object in the triple pattern into a variable.

SELECT ?type WHERE { <http://localhost/web3/topicmaps/123.../topics/456...> xxx ?type }

SPARQL also defines a short-cut for the xxx predicate which is simply the letter 'a' (without the quotes) so our two queries can be written more compactly as:

SELECT ?p WHERE { ?p xxx <http://psi.networkedplanet.com/types/person> }

and

SELECT ?type WHERE { <http://localhost/web3/topicmaps/123.../topics/456...> xxx ?type }