Package implementation.utils
Class ElementUtils
- java.lang.Object
-
- implementation.utils.ElementUtils
-
public class ElementUtils extends java.lang.Object
Several static methods to do various things with JenaElement
- 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 Elementstatic 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 Elementsstatic 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 propertiesstatic java.util.Set<org.apache.jena.sparql.syntax.Element>
relaxFilter(org.apache.jena.sparql.syntax.ElementFilter filter, CollectionsModel model, int descriptionDepth)
Relaxes a filterstatic java.util.Set<org.apache.jena.sparql.syntax.Element>
relaxProperty(org.apache.jena.sparql.core.TriplePath triple, CollectionsModel model)
-
-
-
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 Queryelements
- 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 relaxmodel
- 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 describedmodel
- 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:typemodel
- 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 patternmodel
- 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 answermodel
- The graph to answer the element in- Returns:
- The match-set of the query
- See Also:
Table.toResultSet()
-
-