I've and OWL file and I can explore it and navigate through classes and properties but I can't retrieve correct range of ObjectProperty. This is part of my OWL file:
<owl:ObjectProperty rdf:about="&aat;aat2209_located_in">
<rdfs:label xml:lang="en">located in</rdfs:label>
<rdfs:label xml:lang="it">si trova in</rdfs:label>
<rdfs:comment xml:lang="en">The property defines a relationship between places or places and things</rdfs:comment>
<rdfs:comment xml:lang="it">La proprietà definisce la relazione tra luoghi o tra luoghi e cose</rdfs:comment>
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="&dbpedia-owl;Artwork"/>
<rdf:Description rdf:about="&dbpedia-owl;Cave"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
<rdfs:range>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="&lodmt;ArchaeologicalSite"/>
<rdf:Description rdf:about="&dbpedia-owl;Building"/>
</owl:unionOf>
</owl:Class>
</rdfs:range>
</owl:ObjectProperty>
And this is part of my code to explore OWL file
...
OntModel inf = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
InputStream in =getClass().getResourceAsStream("/"+DATA_IRI);
inf.read(in, "");
OntClass obj = inf.getOntClass(uri);
ExtendedIterator<OntProperty> propIter = obj.listDeclaredProperties(false);
if(propIter.hasNext()){
while (propIter.hasNext()) {
Set<PropertyModel> properties = new HashSet<PropertyModel>();
final OntProperty ontProperty = (OntProperty) propIter.next();
ExtendedIterator<? extends OntProperty> eqProp = ontProperty.listEquivalentProperties();
if(eqProp.hasNext()){
while (eqProp.hasNext()) {
OntProperty property = (OntProperty) eqProp.next();
PropertyModel propModel = new PropertyModel();
propModel.setLabel(property.getLocalName());
propModel.setUri(property.getURI());
propModel.setRange(property.getRange().getLocalName());
properties.add(propModel);
}
}
...
Everytime I call property.getRange()
I've this result: http://www.w3.org/2002/07/owl#Thing.
Anyone help me?
owl:Thing
is certainly going to be one of them for every object property. It's not an incorrect answer, then, it's just not as specific as you'd like. You can probably get the more specific answer though.. – Joshua Taylorrdf:RDF
element, namespace declarations, entity declarations. It's also not minimal; we don't need the rdfs:label, etc., just the rdfs:range. – Joshua Taylor