Re: How to access <owl:Axiom>?

Posted by Jiba on
URL: http://owlready.306.s1.nabble.com/How-to-access-owl-Axiom-tp3406p3407.html

Hi,

These axioms, used for annotating relations, can be accessed in Owlready as follows :

 * Old notations (still supported) : annotation[source, property, target]

where annotation is the annotation property (e.g. label in your example), and source, property and target are the annotatedSource, annotatedProperty and annotatedTarget.

 * New notation : AnnotatedRelation(source, property, target) object, and then use .annotation to access the various annotation (e.g. .label).

Access is both read and write.

Here is an example:


onto = get_ontology("http://example.org/onto.owl")

with onto:
  class C(Thing): pass
  class p(C >> int): pass

  c1 = C()
  c1.p = [1]

  comment[c1, p, 1] = ["comment"]

  a = AnnotatedRelation(c1, p, 1)
  a.comment = ["a comment on the relation"]
  a.label = ["relation label"]


Best regards,
Jiba