jlowenz / hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
0 stars 0 forks source link

OWLAPI - anonymous individuals #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Subj: OWL-API Hypergraph Anonymous Individual Handling
-Problems and Solutions to the difficult scope of AnonymousIndividuals' nodeIDs.

OWL2 Structural Specification: 
Spec requires that NodeIds (eg. gen3423234, _:a1, _:a2) of AnonymousIndividuals 
are unique in the context of exactly  one ontology.  (e.g.: Ont1 may have _:a1, 
Ont2 may have _:a1; NodeIds are equal, but regarded as different, unrelated 
Individuals)
If one ontology imports another and the importclosure would now contain one or 
more pairs of AnonymousIndividuals with equal NodeIds, one AnonymousIndividual 
per pair has to be renamed.

Problem for OWL-API Hypergraph:
A datafactory has to create AnonymousIndividuals ("Ais") without knowing which 
Ontology they will be part of.
Therefore, just like the original OWLAPI Implementation, we create one AI per 
call, even with equal NodeIds (NodeIds can be specified by the caller or are 
incrementally created).
We will have multiple AI Java objects, for which equals is true (duplicates) 
and not look up the AI in the graph like we do for named entities. All AI 
objects will be added to the graph (including duplicates).

@...denotes the storagelocation; same numbers, same reference ?@100 == ?@100.

Behaviour of current implementation for the following sequences:
A) Ontology1-add>Axiom1 { _:a1@100, _:a2@200 } 
B) Ontology1-add>Axiom2 { _:a1@102, _:a2@200 } 
C1) Ontology2-add>Axiom3 { _:a1@104, _:a2@204 }
C2) Ontology2-add>Axiom3 { _:a1@100, _:a2@200 } 

Action A) 
All objects are in the graph, 1 AI, 1 OWLObjectOneOf Class Expression, 1 Axiom.
1) Axiom1 will become a member of Ontology1 (subgraph.add)
2) We check, if _:a1@100 is already a member of Onto1. It is not.
3) We try to find an AI that equals _:a1@100 in our Ontology subgraph. None 
found. 
4) Add _:a1@100 to Ontology Subgraph.
5) Execute 2) - 4) for _:a2@200.

Action B) following A)
1) Axiom2 will become a member of Ontology1subgraph.add
2) We check, if _:a1@102 is already a member of Onto1. It is not (!!).
3) We try to find an AI that equals _:a1@102 in our Ontology subgraph. We find 
_:a1@100 (existing-a1). 
4) We will not store _a1@102, but make all HGLinks pointing to _:a1@102 point 
to existing-a1.
5) We iterate over the incidenceSet of _a1@102 and set the target of each 
HGLink to existing-a1.
(A typical member of an incidenceSet will be OWLObjectOneOf, or ObjectHasValue 
or  Assertion axioms.)
6) We check, if _:a2@200 is already a member of Onto1. It is and we have 
nothing to do.

Action C1) following A), B)
We will not find _:a1 or _:a2 in Ontology2 and therefore add the objects as in 
Action A).

Action C2) following A), B) Bad API usage.
As of 2011.10.27, we would add _:a1@100 and _:a2@200 to Ontology2, who are also 
in Ontology1. This is a problem that can occur with poor API usage (Reusing 
reference).
We should make sure that each ontology has exclusive and unique Anonymous 
individuals in all situations.

See: handleAxiomAdded Method in class HGDBOntologyImpl.

Import relationships:
We need to investigate, what exactly happens in the OWL Api manchester 
implementation, if duplicate Anonymous Individual NodeIds occur within an 
importsclosure. Spec says: one needs to be renamed. 

Original issue reported on code.google.com by hollywoo...@gmail.com on 27 Oct 2011 at 9:25