Hi Joshua,

Thank you for the swift reply. Using your recommendations and following code:

Resource negativePropertyAssertion = 
assertionOntModel.createResource(OWL2.NegativePropertyAssertion);
          Property assertionProperty = OWL2.assertionProperty;
          Property sourceIndividual = OWL2.sourceIndividual;
          Property targetIndividual = OWL2.targetIndividual;
          negativePropertyAssertion.addProperty(assertionProperty, 
hasPropertyR);
          negativePropertyAssertion.addProperty(sourceIndividual, 
sourceIndividual);
          negativePropertyAssertion.addProperty(targetIndividual, 
targetIndividual);

manged to create the NegativePropertyAssertion in ABox. 

Thank you! Sam

Saminda Abeyruwan
PhD Student
Dept. of Computer Science,
University of Miami

[email protected]
(305) 457 9753
http://saminda.org/

________________________________________
From: Joshua TAYLOR <[email protected]>
Sent: Monday, January 26, 2015 1:17 PM
To: [email protected]
Subject: Re: Adding NegativePropertyAssertion to ABox

On Mon, Jan 26, 2015 at 1:01 PM, Abeyruwan, Saminda Wishwajith
<[email protected]> wrote:
> I have a relation "R", which relates individual "a" and "b"; such that R(a,b).
> My requirement is to use NegativePropertyAssertion to add
> "not" R(a,b) to my ABox.
> I'm having some problem figuring out using Jena OWL API to do this. Any 
> pointer regarding how to use Jena OWL API to add a 
> "NegativePropertyAssertion?" to ABox is highly appreciated.

I think that negative object property assertions are an OWL2
construction, and not present in OWL1.  Jena's API does not support
OWL2, but only OWL1.  Thus, there are not built in methods for working
with negative property assertions. Jena's APIs are RDF-centric,
though, and you can manually add the RDF triples that encode the OWL
assertion.  In particular, to add the axiom:

    NegativeObjectPropertyAssertion( OPE a1 a2 )

you would add triples of the following form:

_:x rdf:type owl:NegativePropertyAssertion .
_:x owl:sourceIndividual T(a1) .
_:x owl:assertionProperty T(OPE) .
_:x owl:targetIndividual T(a2) .

(See "OWL 2 Web Ontology Language: Mapping to RDF Graphs" [1] for more
details.)  I'm not sure if I've got an example handy for negated
propety assertions, but my answer to "Can I add annotations to object
property assertion from jena?" on Stack Overflow [2] shows an example
of this type of approach, and may be a helpful starting point.

//JT

[1] http://www.w3.org/TR/owl2-mapping-to-rdf/
[2] http://stackoverflow.com/q/18801414/1281433


--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to