public class BasicOntologyNetwork extends java.lang.Object implements OntologyNetwork, Extensible
Modifier and Type | Field and Description |
---|---|
protected java.util.HashSet<Alignment> |
alignments |
private static Namespace |
DEF |
protected Extensions |
extensions |
protected java.lang.String |
INDENT |
(package private) static org.slf4j.Logger |
logger |
protected java.lang.String |
NL
Printing
here we do not use renderers; may be later
|
protected java.util.HashMap<java.net.URI,java.util.Map<java.net.URI,java.util.Set<Alignment>>> |
onto2Align |
protected java.util.Hashtable<java.net.URI,OntologyTriple> |
ontologies |
Constructor and Description |
---|
BasicOntologyNetwork() |
BasicOntologyNetwork(BasicOntologyNetwork noo)
Copy constructor
Clone an ontology network by reinitialising tables
|
Modifier and Type | Method and Description |
---|---|
void |
addAlignment(Alignment al) |
void |
addOntology(Ontology<java.lang.Object> onto) |
void |
addOntology(java.net.URI u) |
protected boolean |
applyComposition(java.util.Properties params)
This only works on normalised networks (and returns a normalised network)
Like usually, it could be improved as:
for each triple of ontologies: o1, o2, o3
al(o1,o3) = al(o1,o3) & al(o1,o2) o al(o2,o3)
& al(o1,o2) o al(o3,o2)-1
& al(o2,o1)-1 o al(o2,o3)
& ...
|
void |
cleanUpAlignments() |
BasicOntologyNetwork |
clone()
Clone does some deeper cloning
It has the same content but a different id (no id indeed)
|
void |
close(boolean reflexive,
boolean symmetric,
boolean transitive,
java.util.Properties params)
Computes the transitive, reflexive, symmetric closure of a network of ontology
Reflexive: LEFT UNDONE
Symmetric: for each pair of ontologies
Transitive: for each triple of ontologies, join its alignment with the composition of the others
Modifies the network (but preserves the semantics)
Reflexivity is left undone (empty alignments in principle)
Because it depends on (a) the type of alignment and (b) the ontology language
The code below is OK, but no alignment type is available...
|
BasicOntologyNetwork |
copyOnto()
This is only a partial clone
|
void |
denormalize()
Denormalizes an ontology network: suppress all empty alignments
Modifies the network
|
static BasicOntologyNetwork |
diff(OntologyNetwork on1,
OntologyNetwork on2)
Difference between two ontology networks...
|
java.util.Set<Alignment> |
getAlignments() |
protected java.util.Set<Alignment> |
getAlignments(OntologyTriple srcTriple,
OntologyTriple dstTriple) |
java.util.Set<Alignment> |
getAlignments(java.net.URI srcOnto,
java.net.URI dstOnto) |
java.lang.String |
getExtension(java.lang.String uri,
java.lang.String label) |
java.util.Collection<java.lang.String[]> |
getExtensions()
Extensions are a way to read and add other information (metadata)
to the alignment structure itself.
|
java.util.Set<java.net.URI> |
getOntologies() |
Ontology<java.lang.Object> |
getOntologyObject(java.net.URI u) |
static Alignment |
getQuasiNormalizedAlignment(OntologyNetwork on,
java.net.URI onto1,
java.net.URI onto2)
Only one alignment between onto1 and onto2, rassembling all those existing and all their inverse
The two ontologies must belong to the network otherwise they should be failure (Exception, null??)
What is missing is the transitive closure...
|
java.util.Set<Alignment> |
getSourceAlignments(java.net.URI onto) |
java.util.Set<Alignment> |
getTargetingAlignments(java.net.URI onto) |
protected static java.util.Set<Alignment> |
intersectAlignments(java.util.Set<Alignment> s1,
java.util.Set<Alignment> s2) |
void |
invert()
Invert all alignments in a network of ontologies
In fact, this is closing by invert!
Modifies the network
|
static BasicOntologyNetwork |
join(OntologyNetwork on1,
OntologyNetwork on2)
Union of two ontology networks...
|
void |
match(java.lang.String method,
boolean reflexive,
boolean symmetric,
java.util.Properties params)
Match ontologies in a network, using existing ontologies as input...
|
static BasicOntologyNetwork |
meet(OntologyNetwork on1,
OntologyNetwork on2)
Intersection of two ontology networks...
|
protected void |
mergeAlignments(OntologyTriple ot1,
OntologyTriple ot2,
Alignment newal)
This only works on normalised networks (and returns a normalised network)
Combine all alignments into one (add an alignment to those existing merging everything)
|
int |
nbCells() |
void |
normalize()
Normalizes an ontology network for it to have exactly one alignment between each pair of ontologies.
|
protected static Alignment |
normalizeAlignmentSet(java.util.Set<Alignment> als,
Ontology<java.lang.Object> onto1,
Ontology<java.lang.Object> onto2)
Merge all alignments between the same ontology as one (conjunction)
Create a new alignment...
|
static OntologyNetwork |
parse(org.apache.jena.rdf.model.Model rdfModel) |
static OntologyNetwork |
read(java.io.InputStream is) |
static OntologyNetwork |
read(java.lang.String uri)
Parsing
here we use Jena
|
void |
remAlignment(Alignment al) |
void |
remOntology(java.net.URI onto) |
void |
setExtension(java.lang.String uri,
java.lang.String label,
java.lang.String value) |
void |
setExtensions(Extensions ext) |
void |
setIndentString(java.lang.String ind) |
void |
setNewLineString(java.lang.String nl) |
void |
trim(java.lang.String method,
double threshold)
Applies a threshold to all alignments in a network
Modifies the network
|
void |
write(java.io.PrintWriter writer) |
static final org.slf4j.Logger logger
protected java.util.Hashtable<java.net.URI,OntologyTriple> ontologies
protected java.util.HashSet<Alignment> alignments
protected Extensions extensions
protected java.util.HashMap<java.net.URI,java.util.Map<java.net.URI,java.util.Set<Alignment>>> onto2Align
protected java.lang.String NL
protected java.lang.String INDENT
private static Namespace DEF
public BasicOntologyNetwork()
public BasicOntologyNetwork(BasicOntologyNetwork noo)
public void addOntology(Ontology<java.lang.Object> onto)
public void addOntology(java.net.URI u)
addOntology
in interface OntologyNetwork
public void remOntology(java.net.URI onto) throws AlignmentException
remOntology
in interface OntologyNetwork
AlignmentException
public void addAlignment(Alignment al) throws AlignmentException
addAlignment
in interface OntologyNetwork
AlignmentException
public void remAlignment(Alignment al) throws AlignmentException
remAlignment
in interface OntologyNetwork
AlignmentException
public void cleanUpAlignments()
public java.util.Set<Alignment> getAlignments()
getAlignments
in interface OntologyNetwork
public int nbCells()
public java.util.Set<java.net.URI> getOntologies()
getOntologies
in interface OntologyNetwork
public Ontology<java.lang.Object> getOntologyObject(java.net.URI u)
public java.util.Set<Alignment> getTargetingAlignments(java.net.URI onto)
getTargetingAlignments
in interface OntologyNetwork
public java.util.Set<Alignment> getSourceAlignments(java.net.URI onto)
getSourceAlignments
in interface OntologyNetwork
public java.util.Set<Alignment> getAlignments(java.net.URI srcOnto, java.net.URI dstOnto)
getAlignments
in interface OntologyNetwork
protected java.util.Set<Alignment> getAlignments(OntologyTriple srcTriple, OntologyTriple dstTriple)
public BasicOntologyNetwork clone()
clone
in class java.lang.Object
public BasicOntologyNetwork copyOnto()
public void invert() throws AlignmentException
invert
in interface OntologyNetwork
AlignmentException
- when something goes wrong (unlikely)public void denormalize() throws AlignmentException
AlignmentException
- when something goes wrong (unlikely)public void normalize() throws AlignmentException
AlignmentException
- when something goes wrong (unlikely)protected void mergeAlignments(OntologyTriple ot1, OntologyTriple ot2, Alignment newal) throws AlignmentException
ot1
- andot2:
- two ontology triplesnewal:
- a new alignment to integrate with the alignment between these ontologiesAlignmentException
- when something goes wrong (unlikely)public void close(boolean reflexive, boolean symmetric, boolean transitive, java.util.Properties params) throws AlignmentException
reflexive:
- if the reflexive closure must be performed (non implements)symmetric:
- if the symmetric closure must be performedtransitive:
- if the transitive closure must be performedparams:
- parameters to pass to closure (currently unused)AlignmentException
- when something goes wrongprotected boolean applyComposition(java.util.Properties params) throws AlignmentException
params:
- parameters to pass to closure (currently unused)AlignmentException
- when something goes wrongprotected static Alignment normalizeAlignmentSet(java.util.Set<Alignment> als, Ontology<java.lang.Object> onto1, Ontology<java.lang.Object> onto2) throws AlignmentException
als:
- a set of alignmentsonto1
- andonto2:
- the two ontologies between which these alignments areAlignmentException
- when something goes wrongpublic static Alignment getQuasiNormalizedAlignment(OntologyNetwork on, java.net.URI onto1, java.net.URI onto2) throws AlignmentException
on:
- a network of ontologiesonto1
- andonto2:
- the URI of two ontologies between which the alignments will be normalisedAlignmentException
- when something goes wrongprotected static java.util.Set<Alignment> intersectAlignments(java.util.Set<Alignment> s1, java.util.Set<Alignment> s2)
public void match(java.lang.String method, boolean reflexive, boolean symmetric, java.util.Properties params) throws AlignmentException
method:
- the ontology matching method to use to matchreflexive:
- if alignments have to be found between the same ontologysymmetric:
- if alignments must be computed symmetricallyparams:
- parameters passed to the matching methodAlignmentException
- when something goes wrongpublic void trim(java.lang.String method, double threshold) throws AlignmentException
method:
- the trimming methodthreshold:
- the trimming thresholdAlignmentException
- when something goes wrongpublic static BasicOntologyNetwork meet(OntologyNetwork on1, OntologyNetwork on2) throws AlignmentException
on1
- andon2:
- the two networks to be metAlignmentException
- when something goes wrongpublic static BasicOntologyNetwork diff(OntologyNetwork on1, OntologyNetwork on2) throws AlignmentException
on1
- andon2:
- the two networks to be substractedAlignmentException
- when something goes wrongpublic static BasicOntologyNetwork join(OntologyNetwork on1, OntologyNetwork on2) throws AlignmentException
on1
- andon2:
- the two networks to be joinedAlignmentException
- when something goes wrongpublic java.util.Collection<java.lang.String[]> getExtensions()
Extensible
getExtensions
in interface Extensible
public void setExtensions(Extensions ext)
setExtensions
in interface Extensible
public void setExtension(java.lang.String uri, java.lang.String label, java.lang.String value)
setExtension
in interface Extensible
public java.lang.String getExtension(java.lang.String uri, java.lang.String label)
getExtension
in interface Extensible
public void setIndentString(java.lang.String ind)
public void setNewLineString(java.lang.String nl)
public void write(java.io.PrintWriter writer) throws AlignmentException
AlignmentException
public static OntologyNetwork read(java.lang.String uri) throws AlignmentException
uri:
- the URL of an RDF graph describing a networkAlignmentException
- when something goes wrong (I/O usually)public static OntologyNetwork read(java.io.InputStream is) throws AlignmentException
AlignmentException
public static OntologyNetwork parse(org.apache.jena.rdf.model.Model rdfModel) throws AlignmentException
AlignmentException
(C) INRIA & friends, 2003-2020