Class EntityMappingImpl
java.lang.Object
se.liu.ida.hefquin.base.data.mappings.impl.EntityMappingImpl
- All Implemented Interfaces:
EntityMapping
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEntityMappingImpl(Map<org.apache.jena.graph.Node, Set<org.apache.jena.graph.Node>> g2l) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.jena.sparql.expr.ExprapplyInverseToExpression(org.apache.jena.sparql.expr.Expr expr) Applies this entity mapping to the given filter expression, which is assumed to use the local representation of the entities mentioned in it, and returns the translated expression.Applies the inverse of this entity mapping to the given solution mapping, which is assumed to use the local representation of the entities that it binds to its query variables.static Set<SolutionMapping> applyMapToSolutionMapping(SolutionMapping solMap, Map<org.apache.jena.graph.Node, Set<org.apache.jena.graph.Node>> x2yMap) org.apache.jena.sparql.expr.ExprapplyToExpression(org.apache.jena.sparql.expr.Expr expr) Applies this entity mapping to the given filter expression, which is assumed to use the global representation of the entities mentioned in it, and returns the translated expression.protected org.apache.jena.sparql.expr.ExprapplyToExpression(org.apache.jena.sparql.expr.Expr expr, boolean useInverse) Applies this entity mapping to the given solution mapping, which is assumed to use the global representation of the entities that it binds to its query variables.Applies this mapping to the given triple pattern and returns the resulting set of triple patterns that is meant to be used as a union.protected List<org.apache.jena.sparql.expr.Expr> expandExpression(org.apache.jena.sparql.expr.Expr e, boolean useInverse) Expands the given expression according to an entity mapping.protected org.apache.jena.sparql.expr.ExprrewriteComparison(org.apache.jena.sparql.expr.Expr expr, boolean useInverse)
-
Field Details
-
g2lMap
-
l2gMap
-
-
Constructor Details
-
EntityMappingImpl
-
-
Method Details
-
createL2G
-
applyToTriplePattern
Description copied from interface:EntityMappingApplies this mapping to the given triple pattern and returns the resulting set of triple patterns that is meant to be used as a union. If this mapping is not relevant for any of the entities mentioned in the given triple pattern (i.e., applying the mapping to the triple pattern does not have any effect), then the result of this function is simply a singleton set that contains the given triple pattern without any changes.- Specified by:
applyToTriplePatternin interfaceEntityMapping
-
applyToExpression
public org.apache.jena.sparql.expr.Expr applyToExpression(org.apache.jena.sparql.expr.Expr expr) Description copied from interface:EntityMappingApplies this entity mapping to the given filter expression, which is assumed to use the global representation of the entities mentioned in it, and returns the translated expression. If this entity mapping is not relevant for the given expression (i.e., applying this entity mapping does not change the expression), then the result of this function is simply the given expression itself.It may not be possible to translate every expression; if the given expression cannot be translated, then this method throws an
UnsupportedOperationException.- Specified by:
applyToExpressionin interfaceEntityMapping
-
applyInverseToExpression
public org.apache.jena.sparql.expr.Expr applyInverseToExpression(org.apache.jena.sparql.expr.Expr expr) Description copied from interface:EntityMappingApplies this entity mapping to the given filter expression, which is assumed to use the local representation of the entities mentioned in it, and returns the translated expression. If this entity mapping is not relevant for the given expression (i.e., applying this entity mapping does not change the expression), then the result of this function is simply the given expression itself.It may not be possible to translate every expression; if the given expression cannot be translated, then this method throws an
UnsupportedOperationException.- Specified by:
applyInverseToExpressionin interfaceEntityMapping
-
applyToExpression
protected org.apache.jena.sparql.expr.Expr applyToExpression(org.apache.jena.sparql.expr.Expr expr, boolean useInverse) -
applyToSolutionMapping
Description copied from interface:EntityMappingApplies this entity mapping to the given solution mapping, which is assumed to use the global representation of the entities that it binds to its query variables. If this entity mapping is not relevant for any of the entities mentioned in the given solution mapping (i.e., applying this entity mapping to the solution mapping does not have any effect), then the result of this function is simply a singleton set that contains the given solution mapping without any changes.- Specified by:
applyToSolutionMappingin interfaceEntityMapping
-
applyInverseToSolutionMapping
Description copied from interface:EntityMappingApplies the inverse of this entity mapping to the given solution mapping, which is assumed to use the local representation of the entities that it binds to its query variables. If this entity mapping is not relevant for any of the entities mentioned in the given solution mapping (i.e., applying this entity mapping to the solution mapping does not have any effect), then the result of this function is simply a singleton set that contains the given solution mapping without any changes.- Specified by:
applyInverseToSolutionMappingin interfaceEntityMapping
-
applyMapToSolutionMapping
public static Set<SolutionMapping> applyMapToSolutionMapping(SolutionMapping solMap, Map<org.apache.jena.graph.Node, Set<org.apache.jena.graph.Node>> x2yMap) -
rewriteComparison
protected org.apache.jena.sparql.expr.Expr rewriteComparison(org.apache.jena.sparql.expr.Expr expr, boolean useInverse) -
expandExpression
protected List<org.apache.jena.sparql.expr.Expr> expandExpression(org.apache.jena.sparql.expr.Expr e, boolean useInverse) Expands the given expression according to an entity mapping.If the expression is a constant URI, it is translated to its corresponding local terms. If multiple local terms exist, a corresponding expression is created for each of them. Expressions that are not constant URIs are returned unchanged as a singleton list. Non-constant expressions are only returned unchanged if they do not contain any mapped global URIs anywhere in their structure.
- Parameters:
e- the expression to expand- Returns:
- the translated expressions
-