Class AlignmentModel

java.lang.Object
it.uniroma2.art.semanticturkey.alignment.AlignmentModel

public class AlignmentModel extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acceptAlignment(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation, RDFResourceRole entity1Role, org.eclipse.rdf4j.model.IRI forcedProperty, boolean setAsDefault, org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn)
    Accepts an alignment and update the alignment model with the outcome of the validation
    void
    acceptAllAlignment(org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn)
    Accepts all the alignments and update the alignment model with the outcome of the validations
    void
    add(File alignmentFile)
     
    void
    addCell(Cell cell)
    Adds a Cell to the alignment
    void
    Adds a collection of Cells to the alignment
    void
    changeMappingProperty(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation, org.eclipse.rdf4j.model.IRI mappingProperty)
    Sets (forcing) the mapping property of an alignment
    void
     
    void
    Deletes all the Cells from the alignment
    void
    Deletes the given Cell from the alignment
    void
    deleteCell(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2)
    Deletes a Cell that contains the given entities from the alignment.
    getCell(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation)
    Returns if exists the aligned Cell with the given entities, null otherwise
    Gets the level of the alignment.
    Gets the baseURI of the first aligned ontology
    Gets the baseURI of the second aligned ontology
    Gets the type (or arity) of the alignment.
    Returns a list of unknown relations (classnames or not known symbols) used in the alignment
    boolean
    Gets the xml compatibility
    boolean
    Returns true if the alignment contains a custom relation (e.g. a relation not in knownRelations)
    Lists all Cells declared in the alignment
    Lists all Cells with the given status
    void
    Processes all the cells and stores the relations in a map that will stores the default mapping properties for them
    void
    rejectAlignment(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation)
    Rejects an alignment and update the model with the outcome of the validation
    void
    Rejects all the alignments and update the model with the outcome of the validations
    void
    Reverses the two ontologies aligned the alignment and the entities in the cells
    void
    serialize(File outputFile)
    Serializes the Alignment content in the given file according to AlignAPI format @param outputFile @throws IOException @throws
    void
    Sets the level of the alignment.
    void
    setOnto1(String ontologyBaseURI)
    Sets the baseURI of the first aligned ontology
    void
    setOnto2(String ontologyBaseURI)
    Sets the baseURI of the second aligned ontology
    void
    Sets the type (or arity) of the alignment.
    void
    setXml(boolean xml)
    Sets the xml compatibility
    List<org.eclipse.rdf4j.model.IRI>
    suggestPropertiesForRelation(RDFResourceRole role, String relation, boolean withDefault)
    Converts the given relation to a property.
    List<org.eclipse.rdf4j.model.IRI>
    suggestPropertiesForRelation(org.eclipse.rdf4j.model.IRI entity, String relation, boolean withDefault, org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn)
    Converts the given relation to a property.
    void
    updateRelation(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String oldRelation, String newRelation, float measure)
    Sets (forcing) the relation between two entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      protected static org.slf4j.Logger logger
  • Constructor Details

    • AlignmentModel

      public AlignmentModel()
  • Method Details

    • add

      public void add(File alignmentFile) throws AlignmentInitializationException
      Throws:
      AlignmentInitializationException
    • preProcess

      public void preProcess()
      Processes all the cells and stores the relations in a map that will stores the default mapping properties for them
    • getUnknownRelations

      public List<String> getUnknownRelations()
      Returns a list of unknown relations (classnames or not known symbols) used in the alignment
      Returns:
    • getLevel

      public String getLevel()
      Gets the level of the alignment. Values: "0", "1", "2EDOAL"
      Returns:
    • setLevel

      public void setLevel(String level)
      Sets the level of the alignment. Values: "0", "1", "2EDOAL"
      Parameters:
      level -
    • getXml

      public boolean getXml()
      Gets the xml compatibility
      Returns:
    • setXml

      public void setXml(boolean xml)
      Sets the xml compatibility
      Parameters:
      xml -
    • getType

      public String getType()
      Gets the type (or arity) of the alignment. Values: "11", "1?", "1+", "1*", "?1", "??", "?+", "?*", "+1", "+?", "++", "+*", "*1", "*?", "?+", "**"
      Returns:
    • setType

      public void setType(String type)
      Sets the type (or arity) of the alignment. Values: "11", "1?", "1+", "1*", "?1", "??", "?+", "?*", "+1", "+?", "++", "+*", "*1", "*?", "?+", "**"
      Parameters:
      type -
    • getOnto1

      public String getOnto1()
      Gets the baseURI of the first aligned ontology
      Returns:
    • setOnto1

      public void setOnto1(String ontologyBaseURI)
      Sets the baseURI of the first aligned ontology
      Parameters:
      ontologyBaseURI -
    • getOnto2

      public String getOnto2()
      Gets the baseURI of the second aligned ontology
      Returns:
    • setOnto2

      public void setOnto2(String ontologyBaseURI)
      Sets the baseURI of the second aligned ontology
      Parameters:
      ontologyBaseURI -
    • getCell

      public Cell getCell(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation)
      Returns if exists the aligned Cell with the given entities, null otherwise
      Parameters:
      entity1 -
      entity2 -
      Returns:
    • listCells

      public List<Cell> listCells()
      Lists all Cells declared in the alignment
      Returns:
    • listCellsByStatus

      public List<Cell> listCellsByStatus(AlignmentModel.Status status)
      Lists all Cells with the given status
      Returns:
    • addCell

      public void addCell(Cell cell)
      Adds a Cell to the alignment
      Parameters:
      cell -
    • addCells

      public void addCells(Collection<Cell> cells)
      Adds a collection of Cells to the alignment
      Parameters:
      cells -
    • deleteCell

      public void deleteCell(Cell cell)
      Deletes the given Cell from the alignment
      Parameters:
      cell -
    • deleteCell

      public void deleteCell(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2)
      Deletes a Cell that contains the given entities from the alignment. The order of the entities is not relevant
      Parameters:
      entity1 -
      entity2 -
    • deleteAllCells

      public void deleteAllCells()
      Deletes all the Cells from the alignment
    • acceptAlignment

      public void acceptAlignment(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation, @Nullable RDFResourceRole entity1Role, @Nullable org.eclipse.rdf4j.model.IRI forcedProperty, boolean setAsDefault, org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn)
      Accepts an alignment and update the alignment model with the outcome of the validation
      Parameters:
      entity1 -
      entity2 -
      relation -
      projRepoConn - repository connection of the ontology, used only for checking the role of the left entity and thus for initializing the mapping property accordingly (e.g. concept => skos:exactMatch, class => owl:equivalentClass, ...) No write operation are performed on such repo
      Throws:
      InvalidAlignmentRelationException
    • acceptAllAlignment

      public void acceptAllAlignment(org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn)
      Accepts all the alignments and update the alignment model with the outcome of the validations
      Parameters:
      projRepoConn - repository connection of the ontology, used to check if relation is valid respect entity1
    • rejectAlignment

      public void rejectAlignment(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation)
      Rejects an alignment and update the model with the outcome of the validation
      Parameters:
      entity1 -
      entity2 -
    • rejectAllAlignment

      public void rejectAllAlignment()
      Rejects all the alignments and update the model with the outcome of the validations
    • updateRelation

      public void updateRelation(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String oldRelation, String newRelation, float measure)
      Sets (forcing) the relation between two entity.
      Parameters:
      entity1 -
      entity2 -
      oldRelation -
      measure -
    • changeMappingProperty

      public void changeMappingProperty(org.eclipse.rdf4j.model.IRI entity1, org.eclipse.rdf4j.model.IRI entity2, String relation, org.eclipse.rdf4j.model.IRI mappingProperty)
      Sets (forcing) the mapping property of an alignment
      Parameters:
      entity1 -
      entity2 -
      relation -
      mappingProperty -
    • suggestPropertiesForRelation

      public List<org.eclipse.rdf4j.model.IRI> suggestPropertiesForRelation(org.eclipse.rdf4j.model.IRI entity, String relation, boolean withDefault, org.eclipse.rdf4j.repository.RepositoryConnection projRepoConn) throws InvalidAlignmentRelationException
      Converts the given relation to a property. The conversion depends on:
      • Relation: =, >, <, %, InstanceOf, HasInstance
      • Type of entity: property, class, instance, concept
      Parameters:
      entity -
      relation -
      withDefault - if cannot infer a property, determine if consider an eventual default property assigned to the relation
      projRepoConn - repository connection for detecting role of entity parameter
      Returns:
      Throws:
      InvalidAlignmentRelationException
    • suggestPropertiesForRelation

      public List<org.eclipse.rdf4j.model.IRI> suggestPropertiesForRelation(RDFResourceRole role, String relation, boolean withDefault) throws InvalidAlignmentRelationException
      Converts the given relation to a property. The conversion depends on:
      • Relation: =, >, <, %, InstanceOf, HasInstance
      • Type of entity: property, class, instance, concept
      Parameters:
      role -
      relation -
      withDefault - if cannot infer a property, determine if consider an eventual default property stored in the alignment model as default for the relation
      Returns:
      Throws:
      InvalidAlignmentRelationException
    • hasCustomRelation

      public boolean hasCustomRelation()
      Returns true if the alignment contains a custom relation (e.g. a relation not in knownRelations)
      Returns:
    • reverse

      public void reverse()
      Reverses the two ontologies aligned the alignment and the entities in the cells
    • serialize

      public void serialize(File outputFile) throws IOException
      Serializes the Alignment content in the given file according to AlignAPI format @param outputFile @throws IOException @throws
      Throws:
      IOException
    • close

      public void close()