Arif Nur Rohman
Arif Nur Rohman

Reputation: 195

SPARQL How To Get Individual By Class Name

Please help me with the SPARQL query. I have an ontology with the class 'Verse' as a subclass of owl:Thing.

The Individuals look like this: individual of Verse

I need to do a SPARQL query, which will retrieve all the individuals according to the Verse (class name).

I have tried this, but it seems like this query is wrong:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?individual ?class
WHERE { 
    ?individual rdf:type owl:NamedIndividual .
    ?class rdf:type owl:Class .
}

ps: for download my ontology data, here

Upvotes: 0

Views: 728

Answers (1)

Bharath Chandra
Bharath Chandra

Reputation: 1

You can directly use the class name from your ontology.

PREFIX ontobible: <ur ontology IRI>

SELECT ?individual
WHERE {
    ?individual a ontobible:Verse .
}

Upvotes: 0

Related Questions