You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Joseph Daryl Locsin <da...@gmail.com> on 2012/10/24 19:37:25 UTC
Problem with setSameAs() LINKED DATA
Hello Jena Users,
I am trying to link two individuals A and B using
*
*
* B.setSameAs(A) *OR* A.setSameAs(B)*
A has properties hasOne, hasTwo
B has a property hasThree
and I'm hoping that the property of B can be inferred as a property of A.
Unfortunately, when I list A's properties, hasThree doesn't appear
This is my setup:
OntModel onto =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, null);
String NAMESPACE1 = "http://mynamespace.one#";
String NAMESPACE2 = "http://mynamespace.two#";
OntClass myClass = onto.createClass(NAMESPACE1 + "MyClass");
Individual a = onto.createIndividual(NAMESPACE1 + "A", myClass);
Individual b = onto.createIndividual(NAMESPACE2 + "B", myClass);
//NOTE: I used a different namespace for B to simulate a different
address, but in this setup it is using the same class type
OntProperty one = onto.createOntProperty(NAMESPACE1 + "hasOne");
OntProperty two = onto.createOntProperty(NAMESPACE1 + "hasTwo");
OntProperty three = onto.createOntProperty(NAMESPACE2 +
"hasThree"); //NOTE: the hasThree property is located in the same
address of B
a.setLiteral(one, true);
a.setLiteral(two, true);
b.setLiteral(three, true);
a.setSameAs(b); //THIS results in the RDF entry for A to
have a line <owl:sameAs rdf:resource:"http://mynamespace.two#B" />
//b.setSameAs(a); //I TRIED using this too, but it
didn't work either
// IN HERE I JUST SET AN ITERATOR TO SHOW ALL OF THE PROPERTIES
OF A
// UNFORTUNATELY, hasThree DOESN'T SHOW UP UNDER THE PROPERTIES
OF A
I would like to ask what am I doing wrong?
Regards,
Daryl
Re: Problem with setSameAs() LINKED DATA
Posted by Joseph Daryl Locsin <da...@gmail.com>.
Yes thanks Dave. I missed that part while building my app. I tried MINI and
it is working perfectly. Unfortunately it took a significant amount of time
to process the result. I guess that's the drawback of MINI. Thank you very
much.
Daryl
On Thu, Oct 25, 2012 at 3:32 PM, Dave Reynolds <da...@gmail.com>wrote:
> As it says in [1] you need to use at least the MINI reasoner
> configuration, not MICRO, to get sameAs inference.
>
> Dave
>
> [1] http://jena.apache.org/**documentation/inference/#**OWLcoverage<http://jena.apache.org/documentation/inference/#OWLcoverage>
>
>
> On 24/10/12 18:37, Joseph Daryl Locsin wrote:
>
>> Hello Jena Users,
>>
>> I am trying to link two individuals A and B using
>> *
>> *
>> * B.setSameAs(A) *OR* A.setSameAs(B)*
>>
>>
>> A has properties hasOne, hasTwo
>>
>> B has a property hasThree
>>
>> and I'm hoping that the property of B can be inferred as a property of A.
>> Unfortunately, when I list A's properties, hasThree doesn't appear
>>
>> This is my setup:
>>
>> OntModel onto =
>> ModelFactory.**createOntologyModel(**OntModelSpec.OWL_MEM_MICRO_**RULE_INF,
>> null);
>>
>> String NAMESPACE1 = "http://mynamespace.one#";
>> String NAMESPACE2 = "http://mynamespace.two#";
>>
>> OntClass myClass = onto.createClass(NAMESPACE1 + "MyClass");
>>
>> Individual a = onto.createIndividual(**NAMESPACE1 + "A",
>> myClass);
>> Individual b = onto.createIndividual(**NAMESPACE2 + "B",
>> myClass);
>> //NOTE: I used a different namespace for B to simulate a
>> different
>> address, but in this setup it is using the same class type
>>
>> OntProperty one = onto.createOntProperty(**NAMESPACE1 +
>> "hasOne");
>> OntProperty two = onto.createOntProperty(**NAMESPACE1 +
>> "hasTwo");
>> OntProperty three = onto.createOntProperty(**NAMESPACE2 +
>> "hasThree"); //NOTE: the hasThree property is located in the
>> same
>> address of B
>>
>> a.setLiteral(one, true);
>> a.setLiteral(two, true);
>> b.setLiteral(three, true);
>>
>> a.setSameAs(b); //THIS results in the RDF entry for A
>> to
>> have a line <owl:sameAs rdf:resource:"http://**mynamespace.two#B<http://mynamespace.two#B>"
>> />
>> //b.setSameAs(a); //I TRIED using this too, but it
>> didn't work either
>>
>> // IN HERE I JUST SET AN ITERATOR TO SHOW ALL OF THE PROPERTIES
>> OF A
>> // UNFORTUNATELY, hasThree DOESN'T SHOW UP UNDER THE PROPERTIES
>> OF A
>>
>> I would like to ask what am I doing wrong?
>>
>>
>> Regards,
>> Daryl
>>
>>
Re: Problem with setSameAs() LINKED DATA
Posted by Dave Reynolds <da...@gmail.com>.
As it says in [1] you need to use at least the MINI reasoner
configuration, not MICRO, to get sameAs inference.
Dave
[1] http://jena.apache.org/documentation/inference/#OWLcoverage
On 24/10/12 18:37, Joseph Daryl Locsin wrote:
> Hello Jena Users,
>
> I am trying to link two individuals A and B using
> *
> *
> * B.setSameAs(A) *OR* A.setSameAs(B)*
>
> A has properties hasOne, hasTwo
>
> B has a property hasThree
>
> and I'm hoping that the property of B can be inferred as a property of A.
> Unfortunately, when I list A's properties, hasThree doesn't appear
>
> This is my setup:
>
> OntModel onto =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, null);
>
> String NAMESPACE1 = "http://mynamespace.one#";
> String NAMESPACE2 = "http://mynamespace.two#";
>
> OntClass myClass = onto.createClass(NAMESPACE1 + "MyClass");
>
> Individual a = onto.createIndividual(NAMESPACE1 + "A", myClass);
> Individual b = onto.createIndividual(NAMESPACE2 + "B", myClass);
> //NOTE: I used a different namespace for B to simulate a different
> address, but in this setup it is using the same class type
>
> OntProperty one = onto.createOntProperty(NAMESPACE1 + "hasOne");
> OntProperty two = onto.createOntProperty(NAMESPACE1 + "hasTwo");
> OntProperty three = onto.createOntProperty(NAMESPACE2 +
> "hasThree"); //NOTE: the hasThree property is located in the same
> address of B
>
> a.setLiteral(one, true);
> a.setLiteral(two, true);
> b.setLiteral(three, true);
>
> a.setSameAs(b); //THIS results in the RDF entry for A to
> have a line <owl:sameAs rdf:resource:"http://mynamespace.two#B" />
> //b.setSameAs(a); //I TRIED using this too, but it
> didn't work either
>
> // IN HERE I JUST SET AN ITERATOR TO SHOW ALL OF THE PROPERTIES
> OF A
> // UNFORTUNATELY, hasThree DOESN'T SHOW UP UNDER THE PROPERTIES
> OF A
>
> I would like to ask what am I doing wrong?
>
>
> Regards,
> Daryl
>