public class BasicAlignment extends java.lang.Object implements Alignment, Extensible
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<?> |
confidenceType |
protected Extensions |
extensions |
protected java.util.Hashtable<java.lang.Object,java.util.Set<Cell>> |
hash1 |
protected java.util.Hashtable<java.lang.Object,java.util.Set<Cell>> |
hash2 |
protected java.lang.String |
level |
(package private) static org.slf4j.Logger |
logger |
protected java.util.Properties |
namespaces |
protected Ontology<java.lang.Object> |
onto1 |
protected Ontology<java.lang.Object> |
onto2 |
protected java.lang.reflect.Method |
relationCreationMethod |
protected java.lang.Class<? extends Relation> |
relationType |
protected long |
time |
protected java.lang.String |
type |
Constructor and Description |
---|
BasicAlignment() |
BasicAlignment(BasicAlignment al)
Generate a (deeper) copy of the alignment object
It has the same content but a different id (no id indeed)
|
Modifier and Type | Method and Description |
---|---|
void |
accept(AlignmentVisitor visitor) |
Cell |
addAlignCell(java.lang.Object ob1,
java.lang.Object ob2) |
Cell |
addAlignCell(java.lang.Object ob1,
java.lang.Object ob2,
java.lang.String relation,
double measure)
Cells are created and indexed at once
|
Cell |
addAlignCell(java.lang.String id,
java.lang.Object ob1,
java.lang.Object ob2,
Relation relation,
double measure) |
BasicCell |
addAlignCell(java.lang.String id,
java.lang.Object ob1,
java.lang.Object ob2,
Relation relation,
double measure,
Extensions extensions) |
Cell |
addAlignCell(java.lang.String id,
java.lang.Object ob1,
java.lang.Object ob2,
java.lang.String relation,
double measure) |
protected void |
addCell(Cell c) |
static Alignment |
aggregate(java.lang.String modality,
java.util.Set<BasicAlignment> aligns)
Aggregating several alignments with aggregator modality applied on confidence
For any set (o, o', n, r) in O and (o, o', n', r) in O' the resulting
alignment will contain:
( o, o', aggr(n,n'), r)
any pair which is in only one alignment is preserved.
|
double |
avgConfidence() |
void |
cleanUp()
Can be used for reducing the amount of memory taken by an alignment
Does nothing in BasicAlignment.
|
java.lang.Object |
clone()
Generate a (very) superficial copy of this alignment object
It has the same content but a different id (no id indeed)
To have a deeper copy use the copy constructor
new BasicAlignment( al );
|
Alignment |
compose(Alignment align)
The second alignment is composed with the first one meaning that for
any pair (o, o', n, r) in O and (o',o", n', r') in O' the resulting
alignment will contain:
( o, o", join(n,n'), compose(r, r')) iff compose(r,r') exists.
|
boolean |
contains(Alignment align)
Each cell of @align is contained in this alignment
no semantics (a semantic predicate would be entails).
|
BasicCell |
createCell(java.lang.String id,
java.lang.Object ob1,
java.lang.Object ob2,
Relation relation,
double measure) |
BasicAlignment |
createNewAlignment(java.lang.Object onto1,
java.lang.Object onto2,
java.lang.Class<? extends Relation> relType,
java.lang.Class<?> confType)
This method is used by the algebraic operators
It has to be overriden by implementations.
|
Relation |
createRelation(java.lang.String rel)
The constructor to use
|
void |
cut(double threshold)
Default cut implementation
For compatibility with API until version 1.1
|
void |
cut(java.lang.String method,
double threshold)
Cut refinement :
Rule:
threshold is betweew 1 and 0
|
void |
cut2(double threshold)
The cut function suppresses from an alignment all the cell over a
particular threshold
|
void |
deleteAllCells() |
Alignment |
diff(Alignment align)
The second alignment is suppresed from the first one meaning that for
any pair (o, o', n, r) in O and (o, o', n', r) in O' the resulting
alignment will contain:
( o, o', diff(n,n'), r)
any pair which is only in the first alignment is preserved.
|
void |
dump(org.xml.sax.ContentHandler h)
Housekeeping
|
boolean |
equals(Alignment align) |
Cell |
getAlignCell1(java.lang.Object ob)
Cells are retrieved
These primitives are deprecated.
|
Cell |
getAlignCell2(java.lang.Object ob)
//@deprecated There is more than one cell about one object
|
java.util.Set<Cell> |
getAlignCells(java.lang.Object ob1,
java.lang.Object ob2) |
java.util.Set<Cell> |
getAlignCells1(java.lang.Object ob)
Cells are retrieved
These primitives are deprecated.
|
java.util.Set<Cell> |
getAlignCells2(java.lang.Object ob) |
java.lang.Object |
getAlignedObject1(java.lang.Object ob)
Each part of the cell can be queried independently.
|
java.lang.Object |
getAlignedObject2(java.lang.Object ob) |
Relation |
getAlignedRelation1(java.lang.Object ob) |
Relation |
getAlignedRelation2(java.lang.Object ob) |
double |
getAlignedStrength1(java.lang.Object ob) |
double |
getAlignedStrength2(java.lang.Object ob) |
java.util.ArrayList<Cell> |
getArrayElements() |
java.lang.Class<?> |
getConfidenceType() |
java.util.Enumeration<Cell> |
getElements() |
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.
|
Extensions |
getExtensionsObject() |
java.net.URI |
getFile1() |
java.net.URI |
getFile2() |
java.lang.String |
getLevel() |
java.lang.Object |
getOntology1() |
java.net.URI |
getOntology1URI() |
java.lang.Object |
getOntology2() |
java.net.URI |
getOntology2URI() |
Ontology<java.lang.Object> |
getOntologyObject1() |
Ontology<java.lang.Object> |
getOntologyObject2() |
static java.util.Properties |
getParameters() |
java.lang.Class<? extends Relation> |
getRelationType() |
java.util.TreeSet<Cell> |
getSortedIterator()
Generates a sorted iterator for the alignment
WARNING: this is quite expensive since it allocates and sort a structure each time
|
java.lang.String |
getType() |
java.lang.String |
getXNamespace(java.lang.String label) |
java.util.Properties |
getXNamespaces() |
void |
harden(double threshold)
The harden function acts like threshold but put all weights to 1.
|
int |
hashCode() |
void |
ingest(Alignment alignment)
Incorporate the cells of the alignment into its own alignment.
|
void |
init(java.lang.Object onto1,
java.lang.Object onto2)
Initialize the alignement before using it
|
void |
init(java.lang.Object onto1,
java.lang.Object onto2,
java.lang.Class<? extends Relation> relType,
java.lang.Class<?> confType)
Initialises the Alignment object with two ontologies.
|
void |
init(java.lang.Object onto1,
java.lang.Object onto2,
java.lang.Object cache)
Initialize the alignement before using it, with some ontology caching trick
//@deprecated The OntologyCache is now internal, use init( onto1, onto2 ) instead
|
BasicAlignment |
inverse()
A new alignment is created such that for
any pair (o, o', n, r) in O the resulting alignment will contain:
( o', o, n, inverse(r)) iff compose(r) exists.
|
void |
invertContent(BasicAlignment result,
java.lang.String label,
java.lang.String method) |
java.lang.String |
invertType() |
java.util.Iterator<Cell> |
iterator() |
Alignment |
join(Alignment align)
The second alignment is join with the first one meaning that for
any pair (e, e', n, r) in A and (e, e', n', r) in A' the resulting
alignment will contain:
( e, e', join(n,n'), r)
any pair which is in only one alignment is preserved.
|
double |
maxConfidence() |
Alignment |
meet(Alignment align)
The second alignment is meet with the first one meaning that for
any pair (e, e', n, r) in A and (e, e', n', r) in A' the resulting
alignment will contain:
( e, e', meet(n,n'), r)
any pair which is in only one alignment is discarded.
|
double |
minConfidence() |
int |
nbCells() |
void |
normalise() |
void |
remCell(Cell c) |
void |
removeAlignCell(Cell c) |
void |
render(AlignmentVisitor renderer)
This should be rewritten in order to generate the axiom ontology instead
of printing it! And then use ontology serialization for getting it
printed.
|
java.lang.String |
rewriteQuery(java.lang.String aQuery)
- replaces all entity IRI by their counterpart in the ontology
Caveats:
- This does only work for alignments with =
- This does not care for the *:x status of alignments
- This does work from ontology1 to ontology2, not the other way around
(use invert() in this case).
|
java.lang.String |
rewriteQuery(java.lang.String aQuery,
java.util.Properties prefix) |
java.lang.String |
rewriteSPARQLQuery(java.lang.String aQuery) |
java.lang.String |
rewriteSPARQLQuery(java.lang.String aQuery,
java.util.Properties prefix) |
void |
setConfidenceType(java.lang.String classname) |
void |
setExtension(java.lang.String uri,
java.lang.String label,
java.lang.String value) |
void |
setExtensions(Extensions ext) |
void |
setFile1(java.net.URI u)
Set the ontology used by the alignment
This URI is in fact a URL of where to fetch the ontology.
|
void |
setFile2(java.net.URI u) |
void |
setLevel(java.lang.String level)
Alignment type:
Currently defined as a String.
|
void |
setOntology1(java.lang.Object ontology) |
void |
setOntology2(java.lang.Object ontology) |
void |
setRelationType(java.lang.String classname) |
void |
setType(java.lang.String type)
Alignment type:
Currently defined a sa String.
|
void |
setXNamespace(java.lang.String label,
java.lang.String uri) |
URIAlignment |
toURIAlignment()
Returns default exception for conversion to URIAlignments
|
java.lang.String |
translateMessage(java.lang.String query) |
double |
varianceConfidence() |
static final org.slf4j.Logger logger
protected Ontology<java.lang.Object> onto1
protected Ontology<java.lang.Object> onto2
protected java.lang.String level
protected java.lang.String type
protected java.lang.Class<? extends Relation> relationType
protected java.lang.reflect.Method relationCreationMethod
protected java.lang.Class<?> confidenceType
protected java.util.Hashtable<java.lang.Object,java.util.Set<Cell>> hash1
protected java.util.Hashtable<java.lang.Object,java.util.Set<Cell>> hash2
protected long time
protected Extensions extensions
protected java.util.Properties namespaces
public BasicAlignment()
public BasicAlignment(BasicAlignment al)
public void accept(AlignmentVisitor visitor) throws AlignmentException
accept
in interface Visitable
AlignmentException
public void init(java.lang.Object onto1, java.lang.Object onto2, java.lang.Class<? extends Relation> relType, java.lang.Class<?> confType) throws AlignmentException
onto1
- andonto2:
- the two aligned ontologiesrelType:
- the type of relations to useconfType:
- the type of confidence measures to useAlignmentException
- when something goes wrongpublic void init(java.lang.Object onto1, java.lang.Object onto2, java.lang.Object cache) throws AlignmentException
Alignment
init
in interface Alignment
onto1
- andAlignmentException
- when cannot initialisepublic void init(java.lang.Object onto1, java.lang.Object onto2) throws AlignmentException
Alignment
init
in interface Alignment
onto1
- andAlignmentException
- if cannot initializepublic static java.util.Properties getParameters()
public double maxConfidence()
public double minConfidence()
public double avgConfidence()
public double varianceConfidence()
public java.lang.Object getOntology1()
getOntology1
in interface Alignment
public java.lang.Object getOntology2()
getOntology2
in interface Alignment
public Ontology<java.lang.Object> getOntologyObject1()
public Ontology<java.lang.Object> getOntologyObject2()
public java.net.URI getOntology1URI()
getOntology1URI
in interface Alignment
public java.net.URI getOntology2URI()
getOntology2URI
in interface Alignment
public void setOntology1(java.lang.Object ontology) throws AlignmentException
setOntology1
in interface Alignment
AlignmentException
public void setOntology2(java.lang.Object ontology) throws AlignmentException
setOntology2
in interface Alignment
AlignmentException
public void setType(java.lang.String type)
Alignment
public java.lang.String invertType()
public void setRelationType(java.lang.String classname) throws AlignmentException
AlignmentException
public java.lang.Class<? extends Relation> getRelationType()
public void setConfidenceType(java.lang.String classname) throws AlignmentException
AlignmentException
public java.lang.Class<?> getConfidenceType()
public void setLevel(java.lang.String level)
Alignment
public void setFile1(java.net.URI u)
Alignment
public java.util.Collection<java.lang.String[]> getExtensions()
Alignment
getExtensions
in interface Extensible
getExtensions
in interface Alignment
public Extensions getExtensionsObject()
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
setExtension
in interface Alignment
public java.lang.String getExtension(java.lang.String uri, java.lang.String label)
getExtension
in interface Extensible
getExtension
in interface Alignment
public java.util.Properties getXNamespaces()
public void setXNamespace(java.lang.String label, java.lang.String uri)
public java.lang.String getXNamespace(java.lang.String label)
public java.util.Enumeration<Cell> getElements()
getElements
in interface Alignment
public java.util.Iterator<Cell> iterator()
public java.util.ArrayList<Cell> getArrayElements()
public void deleteAllCells()
public Cell addAlignCell(java.lang.Object ob1, java.lang.Object ob2) throws AlignmentException
addAlignCell
in interface Alignment
AlignmentException
public Cell addAlignCell(java.lang.Object ob1, java.lang.Object ob2, java.lang.String relation, double measure) throws AlignmentException
Alignment
addAlignCell
in interface Alignment
ob1
- the object of the first ontology in the correspondenceob2
- the object of the second ontology in the correspondencerelation
- the relation between these objectsmeasure
- the confidence measure in the correspondenceAlignmentException
- when something goes wrong (unknown objects, bad relation)public Cell addAlignCell(java.lang.String id, java.lang.Object ob1, java.lang.Object ob2, java.lang.String relation, double measure) throws AlignmentException
AlignmentException
public Relation createRelation(java.lang.String rel) throws AlignmentException
rel:
- the string representing the relationAlignmentException
- when something goes wrongpublic Cell addAlignCell(java.lang.String id, java.lang.Object ob1, java.lang.Object ob2, Relation relation, double measure) throws AlignmentException
AlignmentException
public BasicCell addAlignCell(java.lang.String id, java.lang.Object ob1, java.lang.Object ob2, Relation relation, double measure, Extensions extensions) throws AlignmentException
AlignmentException
public BasicCell createCell(java.lang.String id, java.lang.Object ob1, java.lang.Object ob2, Relation relation, double measure) throws AlignmentException
AlignmentException
protected void addCell(Cell c) throws AlignmentException
AlignmentException
public java.util.Set<Cell> getAlignCells1(java.lang.Object ob) throws AlignmentException
Alignment
getAlignCells1
in interface Alignment
ob
- the object of the first ontology from which to retrieve the correspondencesAlignmentException
- when something goes wrongpublic java.util.Set<Cell> getAlignCells2(java.lang.Object ob) throws AlignmentException
getAlignCells2
in interface Alignment
AlignmentException
public java.util.Set<Cell> getAlignCells(java.lang.Object ob1, java.lang.Object ob2) throws AlignmentException
AlignmentException
public Cell getAlignCell1(java.lang.Object ob) throws AlignmentException
Alignment
getAlignCell1
in interface Alignment
ob
- the object of the first ontology from which to retrieve the correspondenceAlignmentException
- when something goes wrong
//@deprecated There is more than one cell about one objectpublic Cell getAlignCell2(java.lang.Object ob) throws AlignmentException
Alignment
getAlignCell2
in interface Alignment
ob
- the object of the second ontology from which to retrieve the correspondenceAlignmentException
- when something goes wrongpublic java.lang.Object getAlignedObject1(java.lang.Object ob) throws AlignmentException
Alignment
getAlignedObject1
in interface Alignment
ob
- the object of the first ontology from which to retrieve the correspondenceAlignmentException
- when something goes wrong
//@deprecated There is more than one cell about one objectpublic java.lang.Object getAlignedObject2(java.lang.Object ob) throws AlignmentException
getAlignedObject2
in interface Alignment
AlignmentException
public Relation getAlignedRelation1(java.lang.Object ob) throws AlignmentException
getAlignedRelation1
in interface Alignment
AlignmentException
public Relation getAlignedRelation2(java.lang.Object ob) throws AlignmentException
getAlignedRelation2
in interface Alignment
AlignmentException
public double getAlignedStrength1(java.lang.Object ob) throws AlignmentException
getAlignedStrength1
in interface Alignment
AlignmentException
public double getAlignedStrength2(java.lang.Object ob) throws AlignmentException
getAlignedStrength2
in interface Alignment
AlignmentException
public void remCell(Cell c) throws AlignmentException
remCell
in interface Alignment
AlignmentException
public void removeAlignCell(Cell c) throws AlignmentException
AlignmentException
public void cut2(double threshold) throws AlignmentException
threshold:
- the threshold under which to cutAlignmentException
- when something goes wrong (unlikely)public void cut(double threshold) throws AlignmentException
cut
in interface Alignment
threshold:
- the threshold under which to cutAlignmentException
- when something goes wrong (unlikely)public void cut(java.lang.String method, double threshold) throws AlignmentException
cut
in interface Alignment
method:
- the cut method to be used described as:
- getting those cells with strength above n (hard)
- getting the n best cells (best)
- getting those cells with strength at worse n under the best (span)
- getting the n% best cells (perc)
- getting those cells with strength at worse n% of the best (prop)
- getting all cells until a gap of n (hardgap)
- getting all cells until a gap of n% of the last (propgap)threshold:
- the threshold under which to cutAlignmentException
- when something goes wrong (unlikely)public void harden(double threshold) throws AlignmentException
harden
in interface Alignment
threshold:
- the threshold above which to hardenAlignmentException
- when something goes wrong (unlikely)public BasicAlignment createNewAlignment(java.lang.Object onto1, java.lang.Object onto2, java.lang.Class<? extends Relation> relType, java.lang.Class<?> confType) throws AlignmentException
onto1
- andonto2:
- the two aligned ontologiesrelType:
- the type of relations to useconfType:
- the type of confidence measures to useAlignmentException
- when something goes wrongpublic Alignment diff(Alignment align) throws AlignmentException
diff
in interface Alignment
align:
- the alignment which is substractedAlignmentException
- when something goes wrongpublic boolean equals(Alignment align)
public int hashCode()
hashCode
in class java.lang.Object
public boolean contains(Alignment align)
align:
- the alignment for testing containmentpublic static Alignment aggregate(java.lang.String modality, java.util.Set<BasicAlignment> aligns) throws AlignmentException
modality:
- the aggregation modalityaligns:
- the alignments to be aggregatedAlignmentException
- when something goes wrongpublic java.util.TreeSet<Cell> getSortedIterator()
public Alignment meet(Alignment align) throws AlignmentException
meet
in interface Alignment
align:
- AlignmentException
public Alignment join(Alignment align) throws AlignmentException
join
in interface Alignment
AlignmentException
public Alignment compose(Alignment align) throws AlignmentException
compose
in interface Alignment
align:
- the alignment to compose with this oneAlignmentException
- when something goes wrong (e.g., the two alignments are not connected)public void normalise() throws AlignmentException
AlignmentException
public BasicAlignment inverse() throws AlignmentException
inverse
in interface Alignment
AlignmentException
- when something goes wrong (unlikely)public void invertContent(BasicAlignment result, java.lang.String label, java.lang.String method) throws AlignmentException
AlignmentException
public void dump(org.xml.sax.ContentHandler h)
public void ingest(Alignment alignment) throws AlignmentException
alignment:
- the alignment to be included in the current alignmentAlignmentException
- when something goes wrongpublic java.lang.Object clone()
public URIAlignment toURIAlignment() throws AlignmentException
AlignmentException
- when something goes wrong (the alignment cannot be converted)public void render(AlignmentVisitor renderer) throws AlignmentException
render
in interface Alignment
renderer:
- the renderer with which to render the alignmentAlignmentException
- when something goes wrongpublic void cleanUp()
public java.lang.String rewriteQuery(java.lang.String aQuery) throws AlignmentException
aQuery
- -- query to be re-writtenAlignmentException
- when something goes wrongpublic java.lang.String rewriteQuery(java.lang.String aQuery, java.util.Properties prefix) throws AlignmentException
AlignmentException
public java.lang.String rewriteSPARQLQuery(java.lang.String aQuery) throws AlignmentException
AlignmentException
public java.lang.String rewriteSPARQLQuery(java.lang.String aQuery, java.util.Properties prefix) throws AlignmentException
AlignmentException
public java.lang.String translateMessage(java.lang.String query)
(C) INRIA & friends, 2003-2020