Class SMOntologyAggWeightedImpl

All Implemented Interfaces:
SMOntologyAggWeighted, SMOntology, SimilarityMeasure
Direct Known Subclasses:
SMOntologyAggAvgImpl, SMOntologyAggMinImpl

public abstract class SMOntologyAggWeightedImpl extends SMOntologyImpl implements SMOntologyAggWeighted
A description of the measure can be found in SMOntologyAggWeighted.
  • Field Details

  • Constructor Details

    • SMOntologyAggWeightedImpl

      public SMOntologyAggWeightedImpl()
  • Method Details

    • getRelevantResources

      protected Map<String,List<org.apache.jena.rdf.model.RDFNode>> getRelevantResources(org.apache.jena.rdf.model.Resource resource, Ontology ontology)
    • getNormalizedRelationWeights

      protected Map<String,Double> getNormalizedRelationWeights(Map<String,List<org.apache.jena.rdf.model.RDFNode>> queryResources)
      Normalize the defined weights to a sum of 1.0.
      Returns:
      the normalized weights.
    • createDataObjectFromLiteral

      protected DataObject createDataObjectFromLiteral(org.apache.jena.rdf.model.Literal literal)
      Create a matching AtomicObject for a given Literal from the ontology.
      Parameters:
      literal - from the ontology with an DataValue.
      Returns:
      the matching AtomicObject.
    • validLiteralDataClass

      protected boolean validLiteralDataClass(DataClass dataClass)
      Check if is is a valid DataClass (Numeric or String).
      Parameters:
      dataClass - the given DataClass.
      Returns:
      if it is valid.
    • setRelation

      public void setRelation(String relationName, String simMeasure, Double weight)
      Specified by:
      setRelation in interface SMOntologyAggWeighted
      Parameters:
      relationName - name of the relation to be inferred
      simMeasure - similarity measure to be used
      weight - weight of the relation
    • setInferredRelation

      public void setInferredRelation(String relationName, String relationQuery, String relationQueryParamName, String simMeasure, double weight)
      Specified by:
      setInferredRelation in interface SMOntologyAggWeighted
      Parameters:
      relationName - name of the relation to be inferred
      relationQuery - SPARQL string
      relationQueryParamName - name of the parameter used in relationQuery
      simMeasure - similarity measure to be used
      weight - weight of the relation
    • getRelations

      Specified by:
      getRelations in interface SMOntologyAggWeighted
      Returns:
      map with all registered relations and corresponding weight and similarity measure
    • getDefaultWeight

      public double getDefaultWeight()
      Specified by:
      getDefaultWeight in interface SMOntologyAggWeighted
      Returns:
      default weight
    • setDefaultWeight

      public void setDefaultWeight(double defaultWeight)
      Specified by:
      setDefaultWeight in interface SMOntologyAggWeighted
      Parameters:
      defaultWeight - is the default weight for each relation, which hasn't an own weight
    • isIgnoreMissingRelationsInQuery

      public boolean isIgnoreMissingRelationsInQuery()
      Specified by:
      isIgnoreMissingRelationsInQuery in interface SMOntologyAggWeighted
    • setIgnoreMissingRelationsInQuery

      public void setIgnoreMissingRelationsInQuery(boolean ignoreMissingRelationsInQuery)
      Specified by:
      setIgnoreMissingRelationsInQuery in interface SMOntologyAggWeighted