Gamze
Gamze

Reputation: 177

SPARQL Query in Protégé (for individuals)

I am trying to execute a query by using SPARQL Query in Protégé. I simply would like to see which individuals are related to which class.

When I simply write:

SELECT ?individual ?class 
WHERE { 
    ?individual rdf:type owl:NamedIndividual .
    ?class rdf:type owl:Class .
}

It brings me individuals BUT without respect to the classes (or inferred classes). I checked the previous (related) questions but could not retrieve a sufficient answer for my simple issue. What I should write in the query so that only related classes are displayed after the query?

Upvotes: 0

Views: 2753

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

Your query consists of two triple patterns which are not connected by any variable:

The query should be

SELECT ?individual ?class 
WHERE { 
    ?individual rdf:type owl:NamedIndividual .
    ?individual rdf:type ?class .
}

I hope you understand the idea, if not I suggest to read a SPARQL tutorial which explains the concept of pattern matching.

Upvotes: 1

Related Questions