Search Mailing List Archives
[protege-discussion] Dublin core annotation of OWL classes: howTo?
Tania Tudorache
tudorache at stanford.edu
Tue Feb 27 16:37:54 PST 2007
Fabrizio,
Please post OWL related questions on the OWL mailing list.
Thanks,
Tania
Fabrizio wrote:
>
> Hi all,
> I'm trying to add a dc annotation property to a class contained in a
> JenaOWLModel, using the Protege API. I would like to obtain something like
>
> -------------------------------------------------------------------------
>
> <owl:Class rdf:ID="Idaho">
> <rdfs:subClassOf>
> <owl:Class rdf:about="United_States"/>
> </rdfs:subClassOf>
> <dc:identifier>375903</dc:identifier>
> </owl:Class>
>
> -------------------------------------------------------------------------
>
> where "dc:identifier" contains a unique value for the class.
>
> The JAVA code I thought could work is:
>
> OWLModel dublinCoreModel = OwlProtegeIo.openOWLFile("dublincore.owl");
>
> Iterator it;
>
> Collection dcAnnotationProperties = dublinCoreModel.getOWLAnnotationProperties();
>
> it = dcAnnotationProperties.iterator();
>
> while (it.hasNext()) {
> dcAnnotation = (RDFProperty) it.next();
> if ((dcAnnotation.getName()).equals("identifier"))
> break;
> }
>
> idahoNamedClass.addPropertyValue(dcAnnotation, "375903");
>
>
> Unfortunately it doesn't seem to work 'cause the result is:
>
> -------------------------------------------------------------------------
>
> <owl:Class rdf:ID="Idaho">
> <rdfs:subClassOf>
> <owl:Class rdf:about="United_States"/>
> </rdfs:subClassOf>
> <dc:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
> >375903</dc:identifier>
> </owl:Class>
>
> -------------------------------------------------------------------------
>
> Another problem is that after having saved the model in a owl file, when I
> reopen it I would like to access the annotation property "dc:identifier" and its
> value but neither:
>
> Object annotationValue = idahoNamedClass.getPropertyValue(dcAnnotation);
>
> nor:
>
> Collection annotationProperties = idahoNamedClass.getRDFProperties();
>
> seem to help me, cause the property isn't accessible/visible using these methods.
> Has someone had the same problem? Is there an easier way to insert dc
> annotations in a OWLModel?
>
> Thanks.
> Fabrizio
>
>
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
>
More information about the protege-discussion
mailing list