Class SolutionMappingUtils
java.lang.Object
se.liu.ida.hefquin.base.data.utils.SolutionMappingUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidappendValuesClauseEntry(StringBuilder b, List<org.apache.jena.sparql.core.Var> vars, org.apache.jena.sparql.engine.binding.Binding sm, org.apache.jena.sparql.serializer.SerializationContext scxt) static List<SolutionMapping> Applies the given vocabulary mapping to each of the solution mappings of the given iterable (translating them from the global vocabulary to the local vocabulary), collects the resulting solution mappings in a list, and returns this list in the end.static List<SolutionMapping> Applies the given vocabulary mapping to each of the solution mappings of the given iterator (translating them from the global vocabulary to the local vocabulary), collects the resulting solution mappings in a list, and returns this list in the end.static List<SolutionMapping> Applies the given vocabulary mapping to each of the solution mappings of the given iterable (translating them from the local vocabulary to the global vocabulary), collects the resulting solution mappings in a list, and returns this list in the end.static List<SolutionMapping> Applies the given vocabulary mapping to each of the solution mappings of the given iterator (translating them from the local vocabulary to the global vocabulary), collects the resulting solution mappings in a list, and returns this list in the end.static booleancompatible(org.apache.jena.sparql.engine.binding.Binding b1, org.apache.jena.sparql.engine.binding.Binding b2) Returns true if the given bindings are compatible.static booleancompatible(SolutionMapping m1, SolutionMapping m2) Returns true if the given solution mappings are compatible.static booleancontainsBlankNodes(org.apache.jena.sparql.engine.binding.Binding b) Returns true if the given solution mapping binds any of its variables to a blank node.static booleanReturns true if the given solution mapping binds any of its variables to a blank node.static SolutionMappingCreates an empty solution mapping.static SolutionMappingcreateSolutionMapping(org.apache.jena.query.QuerySolution s) Creates a solution mapping based on the givenQuerySolution.static SolutionMappingcreateSolutionMapping(org.apache.jena.sparql.core.Var var, org.apache.jena.graph.Node node) Creates a solution mapping in which the given variable is mapped to the given node.static SolutionMappingcreateSolutionMapping(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node node1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node node2) Creates a solution mapping in which the given variables are mapped to the given nodes, respectively.static SolutionMappingcreateSolutionMapping(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node node1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node node2, org.apache.jena.sparql.core.Var var3, org.apache.jena.graph.Node node3) Creates a solution mapping in which the given variables are mapped to the given nodes, respectively.static StringcreateValuesClause(Iterable<org.apache.jena.sparql.engine.binding.Binding> solmaps, org.apache.jena.sparql.serializer.SerializationContext scxt) Serializes the given collection of solution mappings as a string that can be used in a SPARQL VALUES clause.protected static StringcreateValuesClauseLongForm(List<org.apache.jena.sparql.core.Var> vars, Iterable<org.apache.jena.sparql.engine.binding.Binding> solmaps, org.apache.jena.sparql.serializer.SerializationContext scxt) protected static StringcreateValuesClauseShortForm(List<org.apache.jena.sparql.core.Var> vars, Iterable<org.apache.jena.sparql.engine.binding.Binding> solmaps, org.apache.jena.sparql.serializer.SerializationContext scxt) static booleanequals(Set<SolutionMapping> s1, Set<SolutionMapping> s2) Returns true if the given set of solution mappings are equivalent; that is, if they contain the same number of solution mappings and for each such solution mapping there is an equivalent solution mapping in the respective other set.static booleanequals(SolutionMapping m1, SolutionMapping m2) Returns true if the given solution mappings are equivalent; that is, if they are defined for the exact same set of variables and they are compatible.static booleanequalSets(Set<org.apache.jena.sparql.engine.binding.Binding> s1, Set<org.apache.jena.sparql.engine.binding.Binding> s2) Returns true if the given set of solution mappings are equivalent; that is, if they contain the same number of solution mappings and for each such solution mapping there is an equivalent solution mapping in the respective other set.static Set<org.apache.jena.sparql.core.Var> getAllMentionedVariables(Iterable<org.apache.jena.sparql.engine.binding.Binding> solmaps) Returns a set containing all the variables that have a binding in at least one of the given solution mappings.static booleanincludedIn(org.apache.jena.sparql.engine.binding.Binding b1, org.apache.jena.sparql.engine.binding.Binding b2) Returnstrueif the first solution mapping, b1, is included in the second solution mapping, b2, where we say that 'b1 is included in b2' if the variables in b1 are a proper subset of the variables in b2 and the two solution mappings are compatible.static SolutionMappingmerge(SolutionMapping m1, SolutionMapping m2) Merges the given solution mappings into one, assuming that the given solution mappings are compatible.static Set<SolutionMapping> Performs a nested-loop join between two Solution Mapping iterables.static org.apache.jena.sparql.engine.binding.Bindingrestrict(org.apache.jena.sparql.engine.binding.Binding input, Collection<org.apache.jena.sparql.core.Var> vars) Restricts the given solution mapping to the given set of variables.static SolutionMappingrestrict(SolutionMapping sm, Collection<org.apache.jena.sparql.core.Var> vars) Restricts the given solution mapping to the given set of variables.
-
Constructor Details
-
SolutionMappingUtils
public SolutionMappingUtils()
-
-
Method Details
-
createSolutionMapping
Creates an empty solution mapping. -
createSolutionMapping
Creates a solution mapping based on the givenQuerySolution. -
createSolutionMapping
public static SolutionMapping createSolutionMapping(org.apache.jena.sparql.core.Var var, org.apache.jena.graph.Node node) Creates a solution mapping in which the given variable is mapped to the given node. -
createSolutionMapping
public static SolutionMapping createSolutionMapping(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node node1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node node2) Creates a solution mapping in which the given variables are mapped to the given nodes, respectively. -
createSolutionMapping
public static SolutionMapping createSolutionMapping(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node node1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node node2, org.apache.jena.sparql.core.Var var3, org.apache.jena.graph.Node node3) Creates a solution mapping in which the given variables are mapped to the given nodes, respectively. -
equals
Returns true if the given solution mappings are equivalent; that is, if they are defined for the exact same set of variables and they are compatible. -
equals
Returns true if the given set of solution mappings are equivalent; that is, if they contain the same number of solution mappings and for each such solution mapping there is an equivalent solution mapping in the respective other set. -
equalSets
public static boolean equalSets(Set<org.apache.jena.sparql.engine.binding.Binding> s1, Set<org.apache.jena.sparql.engine.binding.Binding> s2) Returns true if the given set of solution mappings are equivalent; that is, if they contain the same number of solution mappings and for each such solution mapping there is an equivalent solution mapping in the respective other set. -
compatible
Returns true if the given solution mappings are compatible. -
compatible
public static boolean compatible(org.apache.jena.sparql.engine.binding.Binding b1, org.apache.jena.sparql.engine.binding.Binding b2) Returns true if the given bindings are compatible. -
includedIn
public static boolean includedIn(org.apache.jena.sparql.engine.binding.Binding b1, org.apache.jena.sparql.engine.binding.Binding b2) Returnstrueif the first solution mapping, b1, is included in the second solution mapping, b2, where we say that 'b1 is included in b2' if the variables in b1 are a proper subset of the variables in b2 and the two solution mappings are compatible. In other words, b1 and b2 are the same for the subset of variables for which they both have bindings and, additionally, b2 has bindings for additional variables. -
merge
Merges the given solution mappings into one, assuming that the given solution mappings are compatible. -
nestedLoopJoin
public static Set<SolutionMapping> nestedLoopJoin(Iterable<SolutionMapping> i1, Iterable<SolutionMapping> i2) Performs a nested-loop join between two Solution Mapping iterables. If you do not need the join result materialized (as done by this function), it is better to useinstead (or the iterator version:invalid reference
JoiningIterableForSolMapsJoiningIteratorForSolMaps). -
applyVocabularyMappingG2L
public static List<SolutionMapping> applyVocabularyMappingG2L(Iterable<SolutionMapping> it, VocabularyMapping vm) Applies the given vocabulary mapping to each of the solution mappings of the given iterable (translating them from the global vocabulary to the local vocabulary), collects the resulting solution mappings in a list, and returns this list in the end. Attention: While this function materializes the complete list of all the resulting solution mappings, for use cases in which such a materialization is not necessary, useorinvalid reference
RewritingIterableForSolMapsG2Linstead.invalid reference
RewritingIteratorForSolMapsG2L -
applyVocabularyMappingG2L
public static List<SolutionMapping> applyVocabularyMappingG2L(Iterator<SolutionMapping> it, VocabularyMapping vm) Applies the given vocabulary mapping to each of the solution mappings of the given iterator (translating them from the global vocabulary to the local vocabulary), collects the resulting solution mappings in a list, and returns this list in the end. Attention: While this function materializes the complete list of all the resulting solution mappings, for use cases in which such a materialization is not necessary, useorinvalid reference
RewritingIterableForSolMapsG2Linstead.invalid reference
RewritingIteratorForSolMapsG2L -
applyVocabularyMappingL2G
public static List<SolutionMapping> applyVocabularyMappingL2G(Iterable<SolutionMapping> it, VocabularyMapping vm) Applies the given vocabulary mapping to each of the solution mappings of the given iterable (translating them from the local vocabulary to the global vocabulary), collects the resulting solution mappings in a list, and returns this list in the end. Attention: While this function materializes the complete list of all the resulting solution mappings, for use cases in which such a materialization is not necessary, useorinvalid reference
RewritingIterableForSolMapsL2Ginstead.invalid reference
RewritingIteratorForSolMapsL2G -
applyVocabularyMappingL2G
public static List<SolutionMapping> applyVocabularyMappingL2G(Iterator<SolutionMapping> it, VocabularyMapping vm) Applies the given vocabulary mapping to each of the solution mappings of the given iterator (translating them from the local vocabulary to the global vocabulary), collects the resulting solution mappings in a list, and returns this list in the end. Attention: While this function materializes the complete list of all the resulting solution mappings, for use cases in which such a materialization is not necessary, useorinvalid reference
RewritingIterableForSolMapsL2Ginstead.invalid reference
RewritingIteratorForSolMapsL2G -
restrict
public static org.apache.jena.sparql.engine.binding.Binding restrict(org.apache.jena.sparql.engine.binding.Binding input, Collection<org.apache.jena.sparql.core.Var> vars) Restricts the given solution mapping to the given set of variables. Hence, the returned solution mapping will be compatible with the solution mapping given as input, but it will be defined only for the variables that are in the intersection of the given set of variables and the set of variables for which the given solution mapping is defined. -
restrict
public static SolutionMapping restrict(SolutionMapping sm, Collection<org.apache.jena.sparql.core.Var> vars) Restricts the given solution mapping to the given set of variables. Hence, the returned solution mapping will be compatible with the solution mapping given as input, but it will be defined only for the variables that are in the intersection of the given set of variables and the set of variables for which the given solution mapping is defined. -
containsBlankNodes
Returns true if the given solution mapping binds any of its variables to a blank node. -
containsBlankNodes
public static boolean containsBlankNodes(org.apache.jena.sparql.engine.binding.Binding b) Returns true if the given solution mapping binds any of its variables to a blank node. -
getAllMentionedVariables
-
createValuesClause
-
createValuesClauseShortForm
-
createValuesClauseLongForm
-
appendValuesClauseEntry
protected static void appendValuesClauseEntry(StringBuilder b, List<org.apache.jena.sparql.core.Var> vars, org.apache.jena.sparql.engine.binding.Binding sm, org.apache.jena.sparql.serializer.SerializationContext scxt)
-