[Pellet-users] KnowledgeBase changes do not appear in OWLOntology
Evren Sirin
evren at clarkparsia.com
Wed Mar 14 11:51:34 UTC 2007
Sorry, for the late reply. It is a busy time of the year for us. Some
comments below.
On 3/8/07 6:22 AM, Martin Kolb wrote:
> Hi,
>
> here you can download the TestClass I prepared:
> http://87.230.1.132/TestClass.java (it's only about 20 Lines of code).
>
Ok, now I understand the problem. I thought you were trying the
reasoner.getClasses() function which should contain the newly added
function. But you are using ontology.getClasses() which is not modified
by the reasoner. That's expected behavior.
> Meanwhile, I tried the same thing with Jena Reasoner, and when I try to
> list all Classes of the model (model.listClasses()) it throws the Exception:
>
> "Cannot convert node DUMMY to OntClass: it does not have rdf:type
> owl:Class or equivalent" Where DUMMY is the new Class, added by the Same
> Method as in the Code in TestClass.java.
>
Situation for Jena should be different because all the queries you ask a
Jena model is combined with the answers form the reasoner. And when I
modify your code as below it works for me:
String ont_file = "http://87.230.1.132/computer_final.owl";
OntModel model = ModelFactory.createOntologyModel(
PelletReasonerFactory.THE_SPEC );
model.read( ont_file );
model.prepare();
KnowledgeBase kb = ((PelletInfGraph) model.getGraph()).getKB();
//Adding a new Class with complete Namespace (Domain
partialmatch.org does not exist yet)
ATermAppl newClass =
ATermUtils.makeTermAppl("http://partialmatch.org/computer#NewClass");
kb.addClass(newClass);
kb.prepare();
//In the Class Tree, the new Class appears obviously
kb.printClassTree();
//In this Set, the new Class will appear now
Iterator allClasses = model.listClasses();
while (allClasses.hasNext()) {
System.out.println(allClasses.next());
}
There is still an issue with model.getOntClass returning null for the
new URI. I might be able to solve this but as I said earlier this use
case is not really something supported so you might get weird behavior
somewhere else.
> Further, I am testing consistency of a term, added by
> kb.addEquivalentClass(...) to a class added by the method mentioned
> above. Maybe that is connected with the errors I listed above, the
> reasoner always gets out of Memory if I even try to print the class
> tree. (Irrespective of which API I use, the Pellet-OWL-Api, or the
> Jena-Framework). Are there any other known performance issues with
> qualified number restrictions (that's the thing I am working on...)
>
No, not anything that does not also affect unqualified number
restrictions, e.g. a cardinality restriction with values greater than
100 are likely to cause problem.
Regards,
Evren
> Thank you in advance,
>
> Martin Kolb
>
> Evren Sirin schrieb:
>
>> On 3/7/07 9:38 AM, Martin Kolb wrote:
>>
>>> Hello everybody,
>>>
>>> I am using Pellet with the OWL Api. I am usually loading an ontology
>>> into a OWLOntology Object, and the
>>> org.mindswap.pellet.owlapi.Reasoner.
>>>
>>> During my program, changes are made via the ATerm-Library directly on
>>> the KnowledgeBase Object, retrieved with reasoner.getKB().
>>> But, if I add Classes to the KnowledgeBase and call prepare(), they do
>>> not appear in the set of all Classes which I can retrieve through
>>> reasoner.getClasses() later.
>>> Maybe that even is not supposed to be?
>>>
>>>
>> This is not really a use case I have considered but I would think it
>> should work because all the Reasoner class does is to call functions
>> from the underlying KB and translate results to OWLAPI structures. If
>> you have a complete minimal code example showing the problem I could
>> take a look.
>>
>> Cheers,
>> Evren
>>
>>> Thank you in advance for any hints,
>>> Regards,
>>>
>>> Martin Kolb
>>>
>>> _______________________________________________
>>> Pellet-users mailing list
>>> Pellet-users at lists.owldl.com
>>> http://lists.owldl.com/mailman/listinfo/pellet-users
>>> _______________________________________________
>>>
>>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>>>
>>>
>>
More information about the Pellet-users
mailing list