Reputation: 689
I need to retrieve all classes available in a camera.owl file (https://github.com/quoll/mulgara/blob/master/data/camera.owl). Here is my query and I feel something wrong in it but hard to figure it out.
String queryString = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>"
+ "PREFIX : <http://www.xfront.com/owl/ontologies/camera/#>"
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" +
"SELECT DISTINCT ?class WHERE { ?s a ?class . }";
Upvotes: 0
Views: 1087
Reputation: 8465
You "feel something wrong"...that's not helpful in computer science or even any science. You should really describe what is not working next time, e.g. "doesn't return anything" or "leads to an exception" or "doesn't return what I'd expect" or ...
Your query does what you want but only for those classes that have instances. And this ontology doesn't contain any instance data.
Alternatively, you can query for all resource of type owl:Class
, i.e. you work on the schema level (Note, this does only work if there are OWL classes, thus, for RDFS it wouldn't work):
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?class WHERE { ?class a owl:Class }
Upvotes: 1