Re: How to use ontModel.listHierarchyRootClasses() properly

2019-09-06 Thread Lorenz Buehmann
yes SPARQL is indeed possible. But in that case, I'd go the SPARQL 1.1 way: |SELECT DISTINCT  ?s|| ||WHERE|| ||  { ?s  a  owl:Class|| ||    FILTER ( ! isBlank(?s) )|| ||    FILTER ( ?s NOT IN (owl:Thing, owl:Nothing) )|| ||    FILTER NOT EXISTS { ?s  rdfs:subClassOf  ?super|| ||  

Re: How to use ontModel.listHierarchyRootClasses() properly

2019-09-05 Thread Alex To
Thanks Lorenz I figured out the union thing too so I ended up using the below SPARQL instead and it seems to work fine but would love to know what is the equivalent using Jena API "SELECT DISTINCT ?s WHERE { " + "?s a owl:Class . " + "FILTER (!isBlank(?s)) " + "FILTER (?s

Re: How to use ontModel.listHierarchyRootClasses() properly

2019-09-05 Thread Lorenz Buehmann
schema.org contains a bunch of anonymous classes like the union of other classes which are used as domain or range of a property, that's why you get null values because they do not have a URI. If you'd just call  |System.out.println(clazz);| you'd see the blank node Ids. Among all those blank

How to use ontModel.listHierarchyRootClasses() properly

2019-09-04 Thread Alex To
Hi I am trying to load schema.org ontology and get all top classes using ontModel.listHierarchyRootClasses() but can't get the expected results with different OntModelSpec. If I use OWL_MEM, it lists 2500+ records with all the records have "null" URI. If I use OWL_DL_MEM, it lists 0 records The