[THEA2] Asserting axiomAnnotations

27 views
Skip to first unread message

Jochem Liem

unread,
Jan 24, 2011, 11:21:33 AM1/24/11
to thea-owl-lib
Dear developers,

I would like to use the Thea2 library in our Interactive Learning
Environment (http://www.dynalearn.eu). The library suits my needs
perfectly except for one particular pattern. I would like to add an
axiomAnnotation as shown below in abstract syntax and RDF/OWL.
However, I have not managed to figure out the assert_axiom that I
should use. The example code I am using is below the RDF/OWL.

I would very much appreciate if you could tell me how such
axiomAnnotations could asserted.

Many thanks,
Jochem Liem

ObjectPropertyAssertion(
Annotation(rdfs:comment "Comment on the preys_on property between
Lion and Zebra "^^rdf:PlainLiteral)
<http://www.animalworld.nl/aw.owl#preys_on>
<http://www.animalworld.nl/aw.owl#Lion>
<http://www.animalworld.nl/aw.owl#Zebra>
)

<owl:Axiom>
<rdfs:comment>Comment on the preys_on property between Lion and
Zebra </rdfs:comment>
<owl:annotatedSource rdf:resource="&aw;Lion"/>
<owl:annotatedTarget rdf:resource="&aw;Zebra"/>
<owl:annotatedProperty rdf:resource="&aw;preys_on"/>
</owl:Axiom>

thea_test :-
assert_axiom(class('aw:Animal')),
assert_axiom(objectProperty('aw:preys_on')),
assert_axiom(namedIndividual('aw:Lion')),
assert_axiom(classAssertion('aw:Lion', 'aw:Animal')),
assert_axiom(namedIndividual('aw:Zebra')),
assert_axiom(classAssertion('aw:Zebra', 'aw:Animal')),
assert_axiom(propertyAssertion('aw:preys_on', 'aw:Lion1',
'aw:Zebra1')),

save_axioms('ontology-test.owl', owl, [write_xml_base(true)]),
retract_axiom(_),
retract_all_axioms.

Chris Mungall

unread,
Jan 24, 2011, 2:41:48 PM1/24/11
to thea-o...@googlegroups.com

Hi Jochem

The model treats axiom annotations as axioms:

%% axiomAnnotation(?Axiom, ?AnnotationProperty, ?AnnotationValue)

so the intention is that you should be able to do this:

assert_axiom( axiomAnnotation( propertyAssertion( preys_on, lion, zebra ), 'rdfs:comment', literal('Comment on the preys_on property between Lion and Zebra'))).

however, a couple of warnings:

[1] this _should_ also have the effect of assertion the core propertyAssertion axiom, but it won't. In OWL2-DL it's syntactically impossible to have an axiom annotation without the axiom being in the model.
[2] There is an issue on the tracker on round-tripping axiom annotations to rdf/xml

The first should be easy to address. I may need Vangelis to take a look at [2].

I'm using axiom annotations a lot so am keen to see this part of the library completed!

Cheers
Chris

Chris Mungall

unread,
Jan 25, 2011, 12:55:37 AM1/25/11
to thea-o...@googlegroups.com

Apologies, it's a little more complicated than I first stated. In most cases, the prolog predicates map directly to the structural syntax, but annotations on axioms or ontologies are treated differently, since the owl syntax doesn't map cleanly to prolog here.

In the model, all annotations on axioms or ontologies or annotations themselves are stored as annotation/3.

so this should work:

assert_axiom( annotation( propertyAssertion( preys_on, lion, zebra ), 'rdfs:comment', literal('Comment on the preys_on property between Lion and Zebra'))).

However, annotation/3 isn't itself treated as an axiom. I think it would be cleaner if it were.

V, what do you think about re-instating this line:
% axiom(annotation(A,B,C)) :- annotation(A,B,C).

Vangelis Vassiliadis

unread,
Jan 25, 2011, 1:55:43 AM1/25/11
to thea-o...@googlegroups.com
I'm working on a complete solution to it. Need to refresh my memory a bit. I hope a solution will be there by end of day.

Regards,
Vangelis

Vangelis Vassiliadis

unread,
Jan 25, 2011, 9:44:51 AM1/25/11
to thea-o...@googlegroups.com
Chris,Jochem,

1/ annotations/3 is used as to store all OWL2 mode Annotation axioms (all 3, axiomAnnotations, ontologyAnnotations and annotationAnnotations).
2/ Jochem: indeed you should assert the annotation/3 axiom as Chris suggests. See the attached modified test file
3/ Chris: annotation/3 is not defined as axiom/1 (commented out) but this does not impact the roundtripping between RDF/XML and the model.
4/ A bug was found for the issue 8 and fixed in the *axiomannotations* branch. Chris can you verify? to me it seems correct.
5/ Jochem's case has one more problem: his test file generates incomplete RDF/XML. see attachment 2. NS handling by SWI's RDF parser treats 
    &ns1;preys_on different than ns1:preys_on resulting in the loading the annotations correctly.
    You need to edit the file adding 
                                                  xmlns:ns1="&ns1;"
    in the list of <RDF element attributes....

Regards,
Vangelis
annotations_test.pl
ontology-test.owl

Chris Mungall

unread,
Jan 25, 2011, 1:51:36 PM1/25/11
to thea-o...@googlegroups.com

On Jan 25, 2011, at 6:44 AM, Vangelis Vassiliadis wrote:

> Chris,Jochem,
>
> 1/ annotations/3 is used as to store all OWL2 mode Annotation axioms (all 3, axiomAnnotations, ontologyAnnotations and annotationAnnotations).
> 2/ Jochem: indeed you should assert the annotation/3 axiom as Chris suggests. See the attached modified test file
> 3/ Chris: annotation/3 is not defined as axiom/1 (commented out) but this does not impact the roundtripping between RDF/XML and the model.

There are many cases where it's useful to iterate over all axioms performing some operation. For example, the prolog dumper simply does al

forall(axiom(A),
format('~q.~n',[A]).

I suppose we can add a new predicate axiomOrAnnotation that can be used in its place - although using axiom/1 is kind of hard-coded in my brain now...

> 4/ A bug was found for the issue 8 and fixed in the *axiomannotations* branch. Chris can you verify? to me it seems correct.

See comments - looks fine - in fact this might have been working before, the problem being I was checking the parsing by dumping prolog using the above method!

There's one more potential issue. The current rdf/xml exporter uses bNodes to avoid exporting the same structure again and again. I have fixed this on the pkb branch by commenting out this:

% NO STRUCTURE SHARING IN OWL2
%as2rdf_bnode(X,Node) :-
% blanknode_gen(Node,X),
% debug(bnode,'bnode REUSE ~w ==> ~w',[X,Node]),
% !.

however, the owl2_export_annotation/5 clauses still forces bNodes when there are axioms annotations where the target of the axiom is anonymous. This is technically invalid OWL2-DL, and Protege4 seems to have a problem with it (this is really annoying as using bnodes is a nice way to cut down on the excessive rdf/xml verbiage, ah well)

> <annotations_test.pl><ontology-test.owl>

Jochem Liem

unread,
Jan 27, 2011, 3:05:25 AM1/27/11
to thea-o...@googlegroups.com
Dear Vangalis/Chris,

Many thanks for developing a solution. I've downloaded the
axiomannotation branch and will try to use it to implement OWL
export/import functionality in our tool.

Thanks for a very nice library!

Best regards,
Jochem

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Jochem Liem, MSc.
Informatics Institute
Faculty of Science
University of Amsterdam
http://www.science.uva.nl/~jliem/

Phone:  +31 (0)20 525 6801
Mobile: +31 (0)6  4321 9992
Fax:     +31 (0)20 525 7490

Visitor address:
Science Park 904, C2.248
1098 XH Amsterdam

Mailing address:
Postbus 94323
1090 GH Amsterdam
The Netherlands
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply all
Reply to author
Forward
0 new messages