Class Cluster

  • All Implemented Interfaces:
    java.lang.Comparable<Cluster>

    public class Cluster
    extends java.lang.Object
    implements java.lang.Comparable<Cluster>
    Author:
    nk-fouque
    • Method Summary

      Modifier and Type Method Description
      java.lang.String answersListString​(CollectionsModel colMd)
      Not sure if this is useful
      java.lang.String answersString()  
      int compareTo​(Cluster other)  
      boolean connected​(java.util.Set<org.apache.jena.sparql.core.Var> vars)  
      org.apache.jena.sparql.algebra.Table getAnswers()
      The list containing all answers held by this cluster i.e.
      java.util.List<org.apache.jena.graph.Node> getAnswersList()  
      java.util.Set<org.apache.jena.sparql.syntax.Element> getAvailableQueryElements()
      The query elements that have yet to be tested in this cluster
      java.util.Set<org.apache.jena.sparql.core.Var> getConnectedVars()
      The Variables that are connected to this Cluster
      int getExtensionDistance()
      The size of the extension of this Cluster's query (i.e.
      org.apache.jena.sparql.algebra.Table getMatchSet()
      The Match-set containing all the answers to the relaxed query
      MatchTreeRoot getMatchTree()
      This Cluster's Match-Tree
      java.util.Set<org.apache.jena.sparql.core.Var> getProj()
      The head of the query Normally only one variable but represented as a list for theoretical use as a query head
      int getRelaxDistance()
      The number of relaxations done to obtain this cluster
      java.util.Set<org.apache.jena.sparql.syntax.Element> getRelaxQueryElements()
      The body of the relaxed Query
      java.util.Set<org.apache.jena.sparql.syntax.Element> getRemovedQueryElements()
      Query elements that have been tested and thrown away/relaxed, to avoid putting them twice
      void move​(org.apache.jena.sparql.syntax.Element element, java.util.Set<org.apache.jena.sparql.core.Var> vars)
      Substract an element from the available query elements to mark it as used and adds it to the elements distinctive of this Cluster's neighbors
      java.lang.String queryString()  
      void relax​(org.apache.jena.sparql.syntax.Element element, CollectionsModel graph, int descriptionDepth)
      Substracts an element from the available query elements to mark it as used and increases the relax distance of this Cluster by one
      java.lang.String relaxQueryElementsString​(CollectionsModel colMd)  
      java.lang.String toString()  
      java.lang.String toString​(CollectionsModel colMd)
      Same as toString() but uses answersListString(CollectionsModel) to write answers More efficient because it doesn't use a ResultSet
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getProj

        public java.util.Set<org.apache.jena.sparql.core.Var> getProj()
        The head of the query Normally only one variable but represented as a list for theoretical use as a query head
      • getConnectedVars

        public java.util.Set<org.apache.jena.sparql.core.Var> getConnectedVars()
        The Variables that are connected to this Cluster
      • getRelaxQueryElements

        public java.util.Set<org.apache.jena.sparql.syntax.Element> getRelaxQueryElements()
        The body of the relaxed Query
      • getAvailableQueryElements

        public java.util.Set<org.apache.jena.sparql.syntax.Element> getAvailableQueryElements()
        The query elements that have yet to be tested in this cluster
      • getRemovedQueryElements

        public java.util.Set<org.apache.jena.sparql.syntax.Element> getRemovedQueryElements()
        Query elements that have been tested and thrown away/relaxed, to avoid putting them twice
      • getRelaxDistance

        public int getRelaxDistance()
        The number of relaxations done to obtain this cluster
      • getExtensionDistance

        public int getExtensionDistance()
        The size of the extension of this Cluster's query (i.e. the number of answers
      • getMatchSet

        public org.apache.jena.sparql.algebra.Table getMatchSet()
        The Match-set containing all the answers to the relaxed query
      • getAnswers

        public org.apache.jena.sparql.algebra.Table getAnswers()
        The list containing all answers held by this cluster i.e. not in any cluster with a lower relaxation distance
      • compareTo

        public int compareTo​(Cluster other)
        Specified by:
        compareTo in interface java.lang.Comparable<Cluster>
        Returns:
        the difference between this Cluster's relax distance and the other Cluster
      • connected

        public boolean connected​(java.util.Set<org.apache.jena.sparql.core.Var> vars)
        Parameters:
        vars - A list of Variables
        Returns:
        true if this cluster is connected to an element mentioning these variables
      • move

        public void move​(org.apache.jena.sparql.syntax.Element element,
                         java.util.Set<org.apache.jena.sparql.core.Var> vars)
                  throws PartitionException
        Substract an element from the available query elements to mark it as used and adds it to the elements distinctive of this Cluster's neighbors
        Parameters:
        element - The Element to be moved
        vars - The Jena Variables mentioned to the element
        Throws:
        PartitionException
      • relax

        public void relax​(org.apache.jena.sparql.syntax.Element element,
                          CollectionsModel graph,
                          int descriptionDepth)
                   throws PartitionException
        Substracts an element from the available query elements to mark it as used and increases the relax distance of this Cluster by one
        Parameters:
        element - The element to relax
        Throws:
        PartitionException
      • queryString

        public java.lang.String queryString()
        Returns:
        The string for the relaxed Query corresponding to this Cluster
      • answersString

        public java.lang.String answersString()
        Returns:
        the answers as a string formatted by Jena
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getAnswersList

        public java.util.List<org.apache.jena.graph.Node> getAnswersList()
        Returns:
        This cluster's answers as a List of RDF Nodes
      • answersListString

        public java.lang.String answersListString​(CollectionsModel colMd)
        Not sure if this is useful
        Parameters:
        colMd - The model in which to search prefix mappings
      • relaxQueryElementsString

        public java.lang.String relaxQueryElementsString​(CollectionsModel colMd)
        Parameters:
        colMd - The CollectionsModel in which to search prefix mappings