Add elements from one ontology to another

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

Add elements from one ontology to another

jlbellier
Hello,

I am new to OWL and OWLReady2. My problem is the following :
I defined a OWL containing all the elements of my ontology, lets call project_ontology.owl, with IRI IRI1
I built another OWL file containing other items like individuals, based on the items of project_ontology.
I stored them in a file called graph.owl. The IRI is IRI2.

I want to aggregate data from graph.owl to project_ontology.owl. I tried to use :
project_onto.imported_ontologies.append(graph_onto)

and then save the result to the project_ontology.owl file with the .save function.
In my new project_ontology.owl, I can just see :

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xml:base="IRI1"
         xmlns="IRI1#">

<owl:Ontology rdf:about="IRI1">
  <owl:imports rdf:resource="IRI2"/>
</owl:Ontology>


</rdf:RDF>


whereas I expected to see all the objects of graph.owl imported, and defined as NameIndividuals.
As a consequence, all the classes from project_ontology.owl that were not instantiated have disappeared from the new project_ontology.owl file. Furthermore, I cannot see the indiviuals in the OntoGraf tab, and I am not sure this solution is portable.

SO I wonder how it works.
What is the best way to aggregate the content of two OWL file without loosing the original content ?

Thank gou in advance for your help.

Best regards,
Jean-Luc.
Reply | Threaded
Open this post in threaded view
|

Re: Add elements from one ontology to another

Jiba
Administrator
Hello,

Importing ontologies allows the reuse of the content of other ontologies (it is similar to the reuse of classes defined in other Python modules when you import the modules).

It is probably the best solution here, unless you want to copy-paste the content of the ontology (but Owlready does not have such a copy paste functionality yet).

Jiba