Class ElementUtils


  • public class ElementUtils
    extends java.lang.Object
    Several static methods to do various things with Jena Element
    Author:
    nk-fouque
    • Constructor Summary

      Constructors 
      Constructor Description
      ElementUtils()  
    • Method Summary

      Modifier and Type Method Description
      static org.apache.jena.sparql.algebra.Table ans​(org.apache.jena.sparql.syntax.Element element, CollectionsModel model)
      Simulates answering a to a Query containing a single Element
      static java.util.Set<org.apache.jena.sparql.syntax.Element> describeNode​(java.lang.String uri, CollectionsModel model, int depth)  
      static java.lang.String getSelectStringFrom​(java.util.Set<org.apache.jena.sparql.core.Var> vars, java.util.Set<org.apache.jena.sparql.syntax.Element> elements)
      Creates a String for the SPARQL Query given Jena Variables and Elements
      static java.util.Set<org.apache.jena.sparql.core.Var> mentioned​(org.apache.jena.sparql.syntax.Element element)  
      static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxClass​(org.apache.jena.sparql.core.TriplePath triple, CollectionsModel model)
      RDF:type is to be relaxed differently than other properties
      static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxFilter​(org.apache.jena.sparql.syntax.ElementFilter filter, CollectionsModel model, int descriptionDepth)
      Relaxes a filter
      static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxProperty​(org.apache.jena.sparql.core.TriplePath triple, CollectionsModel model)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ElementUtils

        public ElementUtils()
    • Method Detail

      • getSelectStringFrom

        public static java.lang.String getSelectStringFrom​(java.util.Set<org.apache.jena.sparql.core.Var> vars,
                                                           java.util.Set<org.apache.jena.sparql.syntax.Element> elements)
        Creates a String for the SPARQL Query given Jena Variables and Elements
        Parameters:
        vars - The List of Jena Variables to be put in the head of the Query
        elements - The List of Jena Elements to be put in the body of the Query
        Returns:
        The String for the SPARQL Query
      • mentioned

        public static java.util.Set<org.apache.jena.sparql.core.Var> mentioned​(org.apache.jena.sparql.syntax.Element element)
        Returns:
        The variables used in this element
      • relaxFilter

        public static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxFilter​(org.apache.jena.sparql.syntax.ElementFilter filter,
                                                                                       CollectionsModel model,
                                                                                       int descriptionDepth)
        Relaxes a filter
        Parameters:
        filter - The filter to relax
        model - The model in which to describe what has to be relaxed
        Returns:
        A list of all the new Query elements obtained from relaxing the filter (relax(e))
      • describeNode

        public static java.util.Set<org.apache.jena.sparql.syntax.Element> describeNode​(java.lang.String uri,
                                                                                        CollectionsModel model,
                                                                                        int depth)
        Parameters:
        uri - The uri of the Node to be described
        model - The Model to use to describe the Node
        Returns:
        A list of Query elements (triple pattern and Filters) describing the Nodes known properties
      • relaxClass

        public static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxClass​(org.apache.jena.sparql.core.TriplePath triple,
                                                                                      CollectionsModel model)
        RDF:type is to be relaxed differently than other properties
        Parameters:
        triple - A triple pattern with predicate RDF:type
        model - The model in which to search for successors
        Returns:
        A list of all the new Query elements obtained from relaxing the triple pattern (relax(e))
      • relaxProperty

        public static java.util.Set<org.apache.jena.sparql.syntax.Element> relaxProperty​(org.apache.jena.sparql.core.TriplePath triple,
                                                                                         CollectionsModel model)
        Parameters:
        triple - A triple pattern
        model - The model in which to search for successors
        Returns:
        A list of all the new Query elements obtained from relaxing the triple pattern (relax(e))
      • ans

        public static org.apache.jena.sparql.algebra.Table ans​(org.apache.jena.sparql.syntax.Element element,
                                                               CollectionsModel model)
        Simulates answering a to a Query containing a single Element
        Parameters:
        element - The element to answer
        model - The graph to answer the element in
        Returns:
        The match-set of the query
        See Also:
        Table.toResultSet()