Object property assertion instead of Annotation assertion.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Object property assertion instead of Annotation assertion.

Christian
Owlready2
Protege 5.2.0

Hi, I'd like to create an Object property assertion instead of Annotation assertion.

Example:

<code>
from owlready2 import *
import os


namespace._LOG_LEVEL = 1
onto = onto_path.append("/home/cj/")
FILENAME = "/home/cj/test.owl"

if os.path.isfile(FILENAME):
    os.remove(FILENAME)
onto = get_ontology(FILENAME)


with onto:
    class A(Thing):
        pass

    class B(Thing):
        pass

    class isConnected(ObjectProperty):
        domain = [A]
        range = [B]
        pass

a_individual = A("a-individual")
b_individual = B("b-individual")
a_individual.isConnected.append(b_individual)
onto.save()
</code>

In Protege 5.2.0 it is shown as Annotation assertion.

What I am doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Object property assertion instead of Annotation assertion.

Jiba
Administrator
Hello,

I tested your program; the problem is the IRI of your ontology: the IRI must use the HTTP protocol.
Note that the ontology does not necessary need to be downloadable at this IRI: as long as a local copy is available, Owlready will not try to download it.
People usually use dummy IRI starting with http://test.org/

For example, your program works well using:

FILENAME = "http://test.org/test.owl"


Kind regards,
Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Object property assertion instead of Annotation assertion.

William
So it is unnecessary to set onto = get_ontology(url) before the main codes

why not set onto = get_ontology() without arguments or just give an alias for onto. Add url whenever you want after the codes.
Reply | Threaded
Open this post in threaded view
|

Re: Object property assertion instead of Annotation assertion.

Jiba
Administrator
Hi,

The URL given to get_ontology(url) is used:

 * for creating a new ontology, if not loaded (in this case, the entire URL is used),

 * for loading the ontology, if loaded (in this case, if the ontology can be found in the onto_path, only the last part of the URL is used. if not found, the whole URL is used to download it).

Any ontology need an URL, even if it is not saved nor downloaded. This is a constraint from naming convention in semantic web.

Kind regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13