BasicAlignment (Alignment API and Server)
Date: 2010-03-31

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Alignment API and Server 4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## fr.inrialpes.exmo.align.impl
Class BasicAlignment

    java.lang.Object
      fr.inrialpes.exmo.align.impl.BasicAlignment

All Implemented Interfaces:
  Cloneable, Iterable<Cell>, Alignment, Visitable

Direct Known Subclasses:
  EDOALAlignment, ObjectAlignment, URIAlignment

    public class BasicAlignment

extends Object
implements Alignment

Represents a basic ontology alignment, i.e., a fully functionnal alignment for wich the type of aligned objects is not known. In version 3.0 this class is virtually abstract. But it cannot be declared abstract because it uses its own constructor.

Version:
  $Id: BasicAlignment.java 1348 2010-03-21 23:34:08Z euzenat $
Author:
  Jérôme Euzenat, David Loup, Raphaël Troncy

Field Summary
`protected int` | `debug`
`protected Extensions` | `extensions`
`protected Hashtable<Object,Set<Cell>>` | `hash1`
`protected Hashtable<Object,Set<Cell>>` | `hash2`
`protected String` | `level`
`protected BasicParameters` | `namespaces`
`protected Ontology<Object>` | `onto1`
`protected Ontology<Object>` | `onto2`
`protected long` | `time`
`protected String` | `type`

Constructor Summary
`BasicAlignment()`

Method Summary
`void` | `accept(AlignmentVisitor visitor)`
`Cell` | `addAlignCell(Object ob1, Object ob2)`
`Cell` | `addAlignCell(Object ob1, Object ob2, String relation, double measure)` Cells are created and indexed at once
`Cell` | `addAlignCell(String id, Object ob1, Object ob2, Relation relation, double measure)`
`Cell` | `addAlignCell(String id, Object ob1, Object ob2, Relation relation, double measure, Extensions extensions)` Cell methods
`protected void` | `addCell(Cell c)`
`void` | `cleanUp()` Can be used for reducing the amount of memory taken by an alignment Does nothing in BasicAlignment.
`Object` | `clone()` Generate a copy of this alignment object It has the same content but a different id (no id indeed)
`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.
`Cell` | `createCell(String id, Object ob1, Object ob2, Relation relation, double measure)`
`BasicAlignment` | `createNewAlignment(Object onto1, Object onto2)` Algebraic part This is to be improved by (TODO): - improving cell equivalence (maybe not dependent on the confidence...
`void` | `cut(double threshold)` Default cut implementation For compatibility with API until version 1.1
`void` | `cut(String method, double threshold)` Cut refinement : - 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) 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
`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(ContentHandler h)` Housekeeping
`Cell` | `getAlignCell1(Object ob)` Cells are retrieved These primitives are deprecated.
`Cell` | `getAlignCell2(Object ob)` //@deprecated There is more than one cell about one object
`Set<Cell>` | `getAlignCells1(Object ob)` Cells are retrieved These primitives are deprecated.
`Set<Cell>` | `getAlignCells2(Object ob)`
`Object` | `getAlignedObject1(Object ob)` Each part of the cell can be queried independently.
`Object` | `getAlignedObject2(Object ob)`
`Relation` | `getAlignedRelation1(Object ob)`
`Relation` | `getAlignedRelation2(Object ob)`
`double` | `getAlignedStrength1(Object ob)`
`double` | `getAlignedStrength2(Object ob)`
`ArrayList<Cell>` | `getArrayElements()`
`Enumeration<Cell>` | `getElements()`
`String` | `getExtension(String uri, String label)`
`Collection<String[]>` | `getExtensions()` Extensions are a way to read and add other information (metadata) to the alignment structure itself.
`URI` | `getFile1()`
`URI` | `getFile2()`
`String` | `getLevel()`
`Object` | `getOntology1()` Alignment methods *
`URI` | `getOntology1URI()`
`Object` | `getOntology2()`
`URI` | `getOntology2URI()`
`Ontology<Object>` | `getOntologyObject1()`
`Ontology<Object>` | `getOntologyObject2()`
`static Properties` | `getParameters()`
`String` | `getType()`
`String` | `getXNamespace(String label)`
`BasicParameters` | `getXNamespaces()`
`void` | `harden(double threshold)` The harden function acts like threshold but put all weights to 1.
`void` | `ingest(Alignment alignment)` Incorporate the cells of the alignment into its own alignment.
`void` | `init(Object onto1, Object onto2)` Initialize the alignement before using it
`void` | `init(Object onto1, Object onto2, Object cache)` Initialises the Alignment object with two ontologies.
`Alignment` | `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.
`Iterator<Cell>` | `iterator()`
`Alignment` | `join(Alignment align)` The second alignment is join 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'), r) any pair which is in only one alignment is discarded.
`Alignment` | `meet(Alignment align)` The second alignment is meet 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', meet(n,n'), r) any pair which is in only one alignment is preserved.
`int` | `nbCells()`
`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.
`void` | `setExtension(String uri, String label, String value)`
`void` | `setExtensions(Extensions ext)`
`void` | `setFile1(URI u)` Alignment type: Currently defined a sa String.
`void` | `setFile2(URI u)`
`void` | `setLevel(String level)` Alignment type: Currently defined a sa String.
`void` | `setOntology1(Object ontology)`
`void` | `setOntology2(Object ontology)`
`void` | `setType(String type)` Alignment type: Currently defined a sa String.
`void` | `setXNamespace(String label, String uri)`
`URIAlignment` | `toURIAlignment()` Returns default exception for conversion to URIAlignments

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### onto1

    protected Ontology<Object> onto1

### onto2

    protected Ontology<Object> onto2

### debug

    protected int debug

### level

    protected String level

### type

    protected String type

### hash1

    protected Hashtable<Object,Set<Cell>> hash1

### hash2

    protected Hashtable<Object,Set<Cell>> hash2

### time

    protected long time

### extensions

    protected Extensions extensions

### namespaces

    protected BasicParameters namespaces

Constructor Detail

### BasicAlignment

    public BasicAlignment()

Method Detail

### accept

    public void accept(AlignmentVisitor visitor)
                throws AlignmentException

  Specified by:
    `accept` in interface `Visitable`
  Throws:
    `AlignmentException`

### init

    public void init(Object onto1,
                     Object onto2,
                     Object cache)
              throws AlignmentException

  Initialises the Alignment object with two ontologies. These two ontologies can be either an instance of fr.inrialpes.exmo.ontowrap.Ontology which will then replaced the one that was there at creation time or a "concrete" ontology which will be inserted in the fr.inrialpes.exmo.ontowrap.Ontology object.

  Specified by:
    `init` in interface `Alignment`
  Throws:
    `AlignmentException`

### init

    public void init(Object onto1,
                     Object onto2)
              throws AlignmentException

  Description copied from interface: `Alignment`
  Initialize the alignement before using it

  Specified by:
    `init` in interface `Alignment`
  Throws:
    `AlignmentException`

### getParameters

    public static Properties getParameters()

### nbCells

    public int nbCells()

  Specified by:
    `nbCells` in interface `Alignment`

### getOntology1

    public Object getOntology1()

  Alignment methods *

  Specified by:
    `getOntology1` in interface `Alignment`

### getOntology2

    public Object getOntology2()

  Specified by:
    `getOntology2` in interface `Alignment`

### getOntologyObject1

    public Ontology<Object> getOntologyObject1()

### getOntologyObject2

    public Ontology<Object> getOntologyObject2()

### getOntology1URI

    public URI getOntology1URI()

  Specified by:
    `getOntology1URI` in interface `Alignment`

### getOntology2URI

    public URI getOntology2URI()

  Specified by:
    `getOntology2URI` in interface `Alignment`

### setOntology1

    public void setOntology1(Object ontology)
                      throws AlignmentException

  Specified by:
    `setOntology1` in interface `Alignment`
  Throws:
    `AlignmentException`

### setOntology2

    public void setOntology2(Object ontology)
                      throws AlignmentException

  Specified by:
    `setOntology2` in interface `Alignment`
  Throws:
    `AlignmentException`

### setType

    public void setType(String type)

  Description copied from interface: `Alignment`
  Alignment type: Currently defined a sa String. This string is supposed to contain two characters: among ?, 1, *, + Can be implemented otherwise

  Specified by:
    `setType` in interface `Alignment`

### getType

    public String getType()

  Specified by:
    `getType` in interface `Alignment`

### setLevel

    public void setLevel(String level)

  Description copied from interface: `Alignment`
  Alignment type: Currently defined a sa String. This string is supposed to contain two characters: among ?, 1, *, + Can be implemented otherwise

  Specified by:
    `setLevel` in interface `Alignment`

### getLevel

    public String getLevel()

  Specified by:
    `getLevel` in interface `Alignment`

### getFile1

    public URI getFile1()

  Specified by:
    `getFile1` in interface `Alignment`

### setFile1

    public void setFile1(URI u)

  Description copied from interface: `Alignment`
  Alignment type: Currently defined a sa String. This string is supposed to contain two characters: among ?, 1, *, + Can be implemented otherwise

  Specified by:
    `setFile1` in interface `Alignment`

### getFile2

    public URI getFile2()

  Specified by:
    `getFile2` in interface `Alignment`

### setFile2

    public void setFile2(URI u)

  Specified by:
    `setFile2` in interface `Alignment`

### getExtensions

    public Collection<String[]> getExtensions()

  Description copied from interface: `Alignment`
  Extensions are a way to read and add other information (metadata) to the alignment structure itself. getExtensions returns a set of tripes: uri*label*value all three being String

  Specified by:
    `getExtensions` in interface `Alignment`

### setExtensions

    public void setExtensions(Extensions ext)

### setExtension

    public void setExtension(String uri,
                             String label,
                             String value)

  Specified by:
    `setExtension` in interface `Alignment`

### getExtension

    public String getExtension(String uri,
                               String label)

  Specified by:
    `getExtension` in interface `Alignment`

### getXNamespaces

    public BasicParameters getXNamespaces()

### setXNamespace

    public void setXNamespace(String label,
                              String uri)

### getXNamespace

    public String getXNamespace(String label)

### getElements

    public Enumeration<Cell> getElements()

  Specified by:
    `getElements` in interface `Alignment`

### iterator

    public Iterator<Cell> iterator()

  Specified by:
    `iterator` in interface `Iterable<Cell>`
  Specified by:
    `iterator` in interface `Alignment`

### getArrayElements

    public ArrayList<Cell> getArrayElements()

### addAlignCell

    public Cell addAlignCell(String id,
                             Object ob1,
                             Object ob2,
                             Relation relation,
                             double measure,
                             Extensions extensions)
                      throws AlignmentException

  Cell methods

  Throws:
    `AlignmentException`

### addAlignCell

    public Cell addAlignCell(String id,
                             Object ob1,
                             Object ob2,
                             Relation relation,
                             double measure)
                      throws AlignmentException

  Throws:
    `AlignmentException`

### addAlignCell

    public Cell addAlignCell(Object ob1,
                             Object ob2,
                             String relation,
                             double measure)
                      throws AlignmentException

  Description copied from interface: `Alignment`
  Cells are created and indexed at once

  Specified by:
    `addAlignCell` in interface `Alignment`
  Throws:
    `AlignmentException`

### addAlignCell

    public Cell addAlignCell(Object ob1,
                             Object ob2)
                      throws AlignmentException

  Specified by:
    `addAlignCell` in interface `Alignment`
  Throws:
    `AlignmentException`

### createCell

    public Cell createCell(String id,
                           Object ob1,
                           Object ob2,
                           Relation relation,
                           double measure)
                    throws AlignmentException

  Throws:
    `AlignmentException`

### addCell

    protected void addCell(Cell c)
                    throws AlignmentException

  Throws:
    `AlignmentException`

### remCell

    public void remCell(Cell c)
                 throws AlignmentException

  Specified by:
    `remCell` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignCells1

    public Set<Cell> getAlignCells1(Object ob)
                             throws AlignmentException

  Description copied from interface: `Alignment`
  Cells are retrieved These primitives are deprecated. Use getAlignCells1 and getAlignCells2 instead. Reason: this applies only for 1:1 alignments Some implementations might act cleverly (retrieving the best value). Basic implementations may raise the exception

  Specified by:
    `getAlignCells1` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignCells2

    public Set<Cell> getAlignCells2(Object ob)
                             throws AlignmentException

  Specified by:
    `getAlignCells2` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignCell1

    public Cell getAlignCell1(Object ob)
                       throws AlignmentException

  Description copied from interface: `Alignment`
  Cells are retrieved These primitives are deprecated. Use getAlignCells1 and getAlignCells2 instead. Reason: this applies only for 1:1 alignments Some implementations might act cleverly (retrieving the best value). Basic implementations may raise the exception //@deprecated There is more than one cell about one object

  Specified by:
    `getAlignCell1` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignCell2

    public Cell getAlignCell2(Object ob)
                       throws AlignmentException

  Description copied from interface: `Alignment`
  //@deprecated There is more than one cell about one object

  Specified by:
    `getAlignCell2` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedObject1

    public Object getAlignedObject1(Object ob)
                             throws AlignmentException

  Description copied from interface: `Alignment`
  Each part of the cell can be queried independently. These primitives are deprecated. Use getAlignCells1 and getAlignCells2 instead. Reason: this applies only for 1:1 alignments Some implementations might act cleverly (retrieving the best value). Basic implementations may raise the exception

  Specified by:
    `getAlignedObject1` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedObject2

    public Object getAlignedObject2(Object ob)
                             throws AlignmentException

  Specified by:
    `getAlignedObject2` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedRelation1

    public Relation getAlignedRelation1(Object ob)
                                 throws AlignmentException

  Specified by:
    `getAlignedRelation1` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedRelation2

    public Relation getAlignedRelation2(Object ob)
                                 throws AlignmentException

  Specified by:
    `getAlignedRelation2` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedStrength1

    public double getAlignedStrength1(Object ob)
                               throws AlignmentException

  Specified by:
    `getAlignedStrength1` in interface `Alignment`
  Throws:
    `AlignmentException`

### getAlignedStrength2

    public double getAlignedStrength2(Object ob)
                               throws AlignmentException

  Specified by:
    `getAlignedStrength2` in interface `Alignment`
  Throws:
    `AlignmentException`

### removeAlignCell

    public void removeAlignCell(Cell c)
                         throws AlignmentException

  Throws:
    `AlignmentException`

### cut2

    public void cut2(double threshold)
              throws AlignmentException

  The cut function suppresses from an alignment all the cell over a particular threshold

  Throws:
    `AlignmentException`

### cut

    public void cut(double threshold)
             throws AlignmentException

  Default cut implementation For compatibility with API until version 1.1

  Specified by:
    `cut` in interface `Alignment`
  Throws:
    `AlignmentException`

### cut

    public void cut(String method,
                    double threshold)
             throws AlignmentException

  Cut refinement : - 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) Rule: threshold is betweew 1 and 0

  Specified by:
    `cut` in interface `Alignment`
  Throws:
    `AlignmentException`

### toURIAlignment

    public URIAlignment toURIAlignment()
                                throws AlignmentException

  Returns default exception for conversion to URIAlignments

  Throws:
    `AlignmentException`

### harden

    public void harden(double threshold)
                throws AlignmentException

  The harden function acts like threshold but put all weights to 1.

  Specified by:
    `harden` in interface `Alignment`
  Throws:
    `AlignmentException`

### createNewAlignment

    public BasicAlignment createNewAlignment(Object onto1,
                                             Object onto2)
                                      throws AlignmentException

  Algebraic part This is to be improved by (TODO): - improving cell equivalence (maybe not dependent on the confidence... and grounding it on abstract data types) - using algebraic meet and join for relations and confidences (the type of relation used can be declared in the alignment) - check compatibility and setup for type and level - conserve extensions if necessary

  Throws:
    `AlignmentException`

### diff

    public Alignment diff(Alignment align)
                   throws AlignmentException

  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.

  Specified by:
    `diff` in interface `Alignment`
  Throws:
    `AlignmentException`

### meet

    public Alignment meet(Alignment align)
                   throws AlignmentException

  The second alignment is meet 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', meet(n,n'), r) any pair which is in only one alignment is preserved.

  Specified by:
    `meet` in interface `Alignment`
  Throws:
    `AlignmentException`

### join

    public Alignment join(Alignment align)
                   throws AlignmentException

  The second alignment is join 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'), r) any pair which is in only one alignment is discarded.

  Specified by:
    `join` in interface `Alignment`
  Throws:
    `AlignmentException`

### compose

    public Alignment compose(Alignment align)
                      throws AlignmentException

  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.

  Specified by:
    `compose` in interface `Alignment`
  Throws:
    `AlignmentException`

### inverse

    public Alignment inverse()
                      throws AlignmentException

  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.

  Specified by:
    `inverse` in interface `Alignment`
  Throws:
    `AlignmentException`

### dump

    public void dump(ContentHandler h)

  Housekeeping

  Specified by:
    `dump` in interface `Alignment`

### ingest

    public void ingest(Alignment alignment)
                throws AlignmentException

  Incorporate the cells of the alignment into its own alignment. Note: for the moment, this does not copy but really incorporates. So, if hardening is applied, then the ingested alignmment will be modified as well. JE: May be a "force" boolean for really ingesting or copying may be useful

  Throws:
    `AlignmentException`

### clone

    public Object clone()

  Generate a copy of this alignment object It has the same content but a different id (no id indeed)

  Specified by:
    `clone` in interface `Alignment`
  Overrides:
    `clone` in class `Object`

### render

    public void render(AlignmentVisitor renderer)
                throws AlignmentException

  This should be rewritten in order to generate the axiom ontology instead of printing it! And then use ontology serialization for getting it printed.

  Specified by:
    `render` in interface `Alignment`
  Throws:
    `AlignmentException`

### cleanUp

    public void cleanUp()

  Can be used for reducing the amount of memory taken by an alignment Does nothing in BasicAlignment.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Alignment API and Server 4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) INRIA & friends, 2003-2010