[Pellet-users] maxInclusive with Jena Pellet
Brandon Ibach
bibach at earthlink.net
Wed Jun 24 00:20:56 UTC 2009
Hi, Jim...
First off, Pellet 2.0 doesn't support Jena 2.6 until the latest release,
Pellet 2.0 rc7. If you've been trying Jena 2.6 with an earlier version, try
the latest to see if that corrects any issues.
Also, for what you're trying to do, it seems like your code might be a bit
overly complex. In the Pellet install directory, check out
examples/src/org/mindswap/pellet/examples/IndividualsExample.java. The
"runWithJena" method is a fairly simple, yet complete example of how to list
instances of a class.
The key, of course, is that this example was written by Evren. No better
way to learn than to pilfer code from a Java God. ;)
-Brandon :)
On Tue, Jun 23, 2009 at 4:52 PM, James Prentice <prentice.j.a at gmail.com>wrote:
> Hi Brandon,
>
> I haven't used the command line tool, but I did reach some success since my
> first post. I found that if I used pellet 2.0 and used the version of jena
> that is included in the pellet lib/ directory (rather than one of my
> external versions of jena), then the query works (using the original
> xsd:maxInclusive rather than owl:maxInclusive).
>
> In my Java code, the method for reading in the ontology looks like this:
>
> private void populateMeetingSchema() throws IOException{
> schema = ModelFactory.createOntologyModel();
> InputStream inFoafInstanceB =
> FileManager.get().open("meetworld.owl");
>
> schema.read(inFoafInstanceB,defaultNameSpace);
> inFoafInstanceB.close();
> }
>
> This contains both classes and instances. Then the query method is this:
>
> private void runPellet( ){
> Reasoner reasoner = PelletReasonerFactory.theInstance().create();
> inferredMeetings = ModelFactory.createInfModel(reasoner, schema);
>
> Some of the errors I was getting before were due to including the following
> line as the second line in that last method:
>
> reasoner = reasoner.bindSchema(schema);
>
> This was because in a previous example I was reading in two files, one with
> class definitions and one with instance data, and was binding the reasoner
> to the schema before applying it to the data. Not sure if my runPellet()
> method is best practice for the case where all the data (classes and
> instances) are in one file, but it seemed to work okay.
>
> Thanks for your help.
> Jim
>
> On Tue, Jun 23, 2009 at 11:44 AM, Brandon Ibach <bibach at earthlink.net>wrote:
>
>> Jim,
>> Have you tried using the "realize" command of Pellet's command-line tool
>> with your original (XSD namespace) ontology? Something like "pellet realize
>> -l Jena meetings.owl" will load the ontology with Jena and print out the
>> class hierarchy and the instances belonging to each class (more precisely,
>> the most specific class to which an instance belongs in each branch). This
>> command-line syntax is valid for Pellet 2.0.
>>
>> Whether this works or not, can you post your Java code showing how you're
>> loading your ontology and executing the query?
>>
>> -Brandon :)
>>
>> On Tue, Jun 23, 2009 at 1:29 PM, James Prentice <prentice.j.a at gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I've been using Protege to create an ontology about meetings. There is a
>>> class Meeting and a data property "duration" that has an integer range. I
>>> created another class called ShortMeeting which is defined as Meetings with
>>> a duration less than 10 minutes. I then created some meeting instances with
>>> varying durations, including one with a 5 minute duration. If I run the
>>> pellet reasoner within Protege (v 4), it correctly infers that the meeting
>>> is of type ShortMeeting. However, if I load this ontology within the Jena
>>> framework and query for instances of ShortMeeting, there are no results.
>>>
>>> I saw this post which sounds like the same basic problem:
>>>
>>> http://lists.owldl.com/pipermail/pellet-users/2009-February/003396.html
>>>
>>> Basically it sounds like Pellet in Jena expects the OWL namespace instead
>>> of XSD for facets like maxInclusive. I manually edited the RDF/XML to change
>>> all xsd:maxInclusive to owl:maxInclusive, but the query still gives no
>>> results and I am getting errors such as:
>>>
>>> Unsupported axiom: Ignoring triple with unknown property from OWL
>>> namespace: -6e63e87b:1220e1cdc9e:-7ff0 @owl:minInclusive "60"^^xsd:integer
>>> Unsupported axiom: Ignoring triple with unknown property from OWL
>>> namespace: -6e63e87b:1220e1cdc9e:-7fe9 @owl:maxInclusive "10"^^xsd:integer
>>>
>>> I have tried several combinations of Pellet and Jena versions with no
>>> luck, e.g. Pellet 1.5.2 with Jena 2.5.6, Pellet 2.0 and Jena 2.6. Does
>>> anyone have suggestions for the best way to handle facets like minInclusive
>>> and maxInclusive with Jena/Pellet?
>>>
>>> Thanks for your help,
>>> Jim
>>>
>>> _______________________________________________
>>> 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/
>>>
>>
>>
>> _______________________________________________
>> 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/
>>
>
>
> _______________________________________________
> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20090624/bb795a51/attachment.htm
More information about the Pellet-users
mailing list