Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] duplicated relations - inverse properies problems

GEORGE LITSIOS litsiosgeorgios at
Fri Jan 23 10:55:56 PST 2009

Hello all,
I give the problem a little more specific.
I have a Sting with a name of a document,say DocumentX and some keywords about this document.
i Parse the String, i'm taking the DocumentX and i Create an individual at the Document Class. Then i take the keywords one by one and i'm findig mappings in the ontology.The mapping for one keyword is a Class or an individual.
Also i have a propety "hasDocument" and an inverse property "isDocumentOf"
A)if the mapping is a Class i need to make a connection between all the instances of this class and its subclasses with the document. So i make a restriction on the "hasDocument" property with objectvalue the Individual DocumentX. After this i make the restriction subclass of the Class i found from the mapping
B)If the mapping is an individual i need a connection between the individual and the DocumentX. So i add the property "hasDocument" to the individual with object value the individual DocumentX
The code is the following:
 Individual DocumentIndiv=model_base.getIndividual(My_NS+DocObject.get(i).ID);                        if(resource.isClass())                        {                            OntClass ClassForDoc=resource.asClass();                            OntProperty hasDocProp=model_base.getOntProperty(My_NS+"hasDocument");                            HasValueRestriction hasDocRestriction=model_base.createHasValueRestriction(null,hasDocProp,DocumentIndiv);                            hasDocRestriction.addSubClass(ClassForDoc);
                        }                        else if(resource.isIndividual())                        {/*Edw elegxw an einai instance giati tote tha sundesw                          *mono to sugekrimeno instance me to sygekrimeno document                          */                            Individual IndivForDoc=resource.asIndividual();                            
                            OntProperty hasDocProp=model_base.getOntProperty(My_NS+"hasDocument");                            IndivForDoc.addProperty(hasDocProp, DocumentIndiv);                                                  }
After All this i save the model at the same file and i open it with Protege.
I have the folowng problems:
A)The properties added with the first interpretation (The mapping was a Class) are seeing perfect in the ontology, the Individual DocumentX is connected with the "hasDocument" property with the individuals of th Class and the individuals of all subclasses of Class. But if there was also a keyword that has mapping with an individual only (the second interpretation with mapping to individuals) from the above Class and for the same DocumenX, then in this individual at the above class the DocumentX will be appeared two times.
At this interpretation, if the mapping was at a class of my ontology, then the inverse property work perfect too. the documentX will have a connection through "isDocumentOf" with all individuals of the Class.
B)The properties added with the second interpretation (The mapping was an Individual), i can view them on the individual at the editor. The individual has the connection with the "hasDocument" property with the DocumentX, but i can't see the connection through the inverse property "isDocumentOf" at the DocumentX individual.
I'm using the pellet reasoner 1.5.2 and have tried to make the interventions above at the model_reason too (wich is the model came with the pellet reasoner on it),but i had the same problems again.
It seems to resolve the problem with the dublicated relations with the next:
Not to do a restriction on property, but taken one by one the individuals of the class and with an examination if the relation exist in the ontology or not. If the relation is not in ontology then i make it.
But i Can't resolve the probleme of inverse properties. If i put the inverse property by hand one by one as the property above, then in the ontology editor i can't see the connection of documents to the other individuals through the property "isDocumentOf" (Also i was expected that this will work and without to put the inverse relation by hand).
Jena seems to view them because in my "if" commant my code never goes in. But the editor not seeing them.
Eny proposition?
Please help me
Thank you again for your time and for your knowledge you share 
with regards
Windows Live™ Hotmail®:…more than just e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-discussion mailing list