From: Adam F. <a....@dc...> - 2009-08-27 17:13:08
|
I have an input OWL file (here's an excerpt) that defines a class "noun" and a bunch of instances, which have RDFS labels; I can load the file into an OWLOntology and find all the OWLIndividuals that are members of the class or its subclass (using a reasoner). <owl:Class rdf:ID="noun">...</owl:Class> ... <noun rdf:about="Asc#i_fr_m11"> <rdfs:label xml:lang="fr">Production</rdfs:label> ... </noun> Now I need to "read" the values and xml:lang attributes of the RDFS labels (for further processing). The OWL API says that every property is either a data or an object property (I've seen some other approaches that distinguish RDF properties separately), so I expect the rdfs:label to be a datatype property. Is that right? I've tried to get a rough start as follows: URI rdfsLabelUri = OWLRDFVocabulary.RDFS_LABEL.getURI(); OWLDataProperty rdfsLabelProperty = owlDataFactory.getOWLDataProperty(rdfsLabelUri); ... private String getRdfsLabel(OWLIndividual x) throws OWLReasonerException { Set<OWLConstant> labels = inputReasoner.getRelatedValues(x, rdfsLabelProperty); if (labels.isEmpty()) { return null; } return labels.iterator().next().getLiteral(); } but getRdfsLabel always returns null, even for individuals that I know (by inspecting the input file) have rdfs:label values. Have I got the wrong end of the stick? |