Hello,
I would like you to help me with a problem I have when I save an instance.
To explain the situation, I pasted an image of the classes and properties I
have in my Protégé model:
[image: Example.png]
I already have an instance of *type *named "Resolution", and what I want is
to save a new instance of *LegalDocument *with name "MyResolution" and
referencing to the "Resolution" type.
My code is the following:
OntModel ontModel = getModelo(); // read the ontology
OntClass dlClass = ontModel.getOntClass("
http://www.owl-ontologies.com/digesto.owl#LegalDocument");
Individual dlIndividual = ontModel.createIndividual( "
http://www.owl-ontologies.com/digesto.owl# MyResolution" , dlClass);
dlIndividual.addLiteral(new PropertyImpl( "
http://www.owl-ontologies.com/digesto.owl#Name" ), "My Resolution");
dlIndividual.addProperty(ontModel.getProperty( "
http://www.owl-ontologies.com/digesto.owl#has_a" ), "
http://www.owl-ontologies.com/digesto.owl# MyResolution" );
// then write the ontology
And this is what is written in the owl:
<rdf:Description rdf:about="
http://www.owl-ontologies.com/digesto.owl#Resolution">
<Name>Resolution</Name>
</rdf:Description>
<rdf:Description rdf:about="
http://www.owl-ontologies.com/digesto.owl#MyResolution">
<Name>My Resolution</Name>
*<has_a>http://www.owl-ontologies.com/digesto.owl#Resolution</has_a>*
</rdf:Description>
But as you can see, the property is saved as a *literal *instead of an
object property/relation. In that way, the resultant owl would be:
<rdf:Description rdf:about="
http://www.owl-ontologies.com/digesto.owl#Resolution">
<Name>Resolution</Name>
</rdf:Description>
<rdf:Description rdf:about="
http://www.owl-ontologies.com/digesto.owl#MyResolution">
<Name>My Resolution</Name>
*<has_a rdf:resource="
http://www.owl-ontologies.com/digesto.owl#Resolution"/>*
</rdf:Description>
Do you know what is wrong in my code? and what should I change in order to
have as a result the last owl code?
Thank you very much in advance,
Vanesa.