Class SchemaMappingImpl
java.lang.Object
se.liu.ida.hefquin.base.data.mappings.impl.SchemaMappingImpl
- All Implemented Interfaces:
SchemaMapping
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<org.apache.jena.graph.Node, Set<TermMapping>> The keys of this map are global terms, and the value for each such global term is a set of all term mappings that have the global term as theirTermMapping.getGlobalTerm().protected final booleanprotected final Map<org.apache.jena.graph.Node, Set<TermMapping>> The keys of this map are local terms, and the value for each such local term is a set of all term mappings that have the local term as an element of theirTermMapping.getLocalTerms(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.jena.sparql.expr.ExprapplyInverseToExpression(org.apache.jena.sparql.expr.Expr expr) Applies this schema mapping to the given filter expression, which is assumed to use the local schema for the vocabulary terms mentioned in it, and returns the translated expression.Applies the inverse of this schema mapping to the given solution mapping, which is assumed to use the local schema for the vocabulary terms that it binds to its query variables.org.apache.jena.sparql.expr.ExprapplyToExpression(org.apache.jena.sparql.expr.Expr expr) Applies this schema mapping to the given filter expression, which is assumed to use the global schema for the vocabulary terms 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 schema mapping to the given solution mapping, which is assumed to use the global schema for the vocabulary terms that it binds to its query variables.protected Set<SolutionMapping> applyToSolutionMapping(SolutionMapping solMap, boolean useInverse) Applies this mapping to the given triple pattern and returns the resulting graph pattern.List<org.apache.jena.sparql.expr.Expr> expandExpression(org.apache.jena.sparql.expr.Expr e, boolean useInverse) Expands the given expression according to a schema mapping.protected Set<org.apache.jena.graph.Node> extractGlobalTermsForLocalTerm(Set<TermMapping> mappingsForTerm) protected Set<org.apache.jena.graph.Node> extractLocalTermsForGlobalTerm(Set<TermMapping> mappingsForTerm) booleanChecks whether the schema mapping only contains equivalence rules, e.g., owl:equivalentClass, owl:equivalentProperty Return true if the schema mapping consists solely of equivalence rules, false otherwise.protected static booleanpopulateL2G(Map<org.apache.jena.graph.Node, Set<TermMapping>> g2lMap, Map<org.apache.jena.graph.Node, Set<TermMapping>> l2gMap) Populates the given l2gMap based on the given g2lMap and returns whether all theTermMappings in g2lMap are equivalence mappings only.protected org.apache.jena.sparql.expr.ExprrewriteComparison(org.apache.jena.sparql.expr.Expr expr, boolean useInverse)
-
Field Details
-
g2lMap
The keys of this map are global terms, and the value for each such global term is a set of all term mappings that have the global term as theirTermMapping.getGlobalTerm(). The union of all the sets that are values in this map is exactly the same set of term mappings as the union of all the sets that are values inl2gMap. -
l2gMap
The keys of this map are local terms, and the value for each such local term is a set of all term mappings that have the local term as an element of theirTermMapping.getLocalTerms(). The union of all the sets that are values in this map is exactly the same set of term mappings as the union of all the sets that are values ing2lMap. -
isEquivalenceOnly
protected final boolean isEquivalenceOnly
-
-
Constructor Details
-
SchemaMappingImpl
-
-
Method Details
-
populateL2G
protected static boolean populateL2G(Map<org.apache.jena.graph.Node, Set<TermMapping>> g2lMap, Map<org.apache.jena.graph.Node, Set<TermMapping>> l2gMap) Populates the given l2gMap based on the given g2lMap and returns whether all theTermMappings in g2lMap are equivalence mappings only. -
isEquivalenceOnly
public boolean isEquivalenceOnly()Description copied from interface:SchemaMappingChecks whether the schema mapping only contains equivalence rules, e.g., owl:equivalentClass, owl:equivalentProperty Return true if the schema mapping consists solely of equivalence rules, false otherwise.- Specified by:
isEquivalenceOnlyin interfaceSchemaMapping
-
applyToTriplePattern
Description copied from interface:SchemaMappingApplies this mapping to the given triple pattern and returns the resulting graph pattern. If this mapping is not relevant for the 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 the given triple pattern itself.- Specified by:
applyToTriplePatternin interfaceSchemaMapping
-
applyToExpression
public org.apache.jena.sparql.expr.Expr applyToExpression(org.apache.jena.sparql.expr.Expr expr) Description copied from interface:SchemaMappingApplies this schema mapping to the given filter expression, which is assumed to use the global schema for the vocabulary terms mentioned in it, and returns the translated expression. If this schema mapping is not relevant for the given expression (i.e., applying this schema 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 interfaceSchemaMapping
-
applyInverseToExpression
public org.apache.jena.sparql.expr.Expr applyInverseToExpression(org.apache.jena.sparql.expr.Expr expr) Description copied from interface:SchemaMappingApplies this schema mapping to the given filter expression, which is assumed to use the local schema for the vocabulary terms mentioned in it, and returns the translated expression. If this schema mapping is not relevant for the given expression (i.e., applying this schema 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 interfaceSchemaMapping
-
applyToExpression
protected org.apache.jena.sparql.expr.Expr applyToExpression(org.apache.jena.sparql.expr.Expr expr, boolean useInverse) -
applyToSolutionMapping
Description copied from interface:SchemaMappingApplies this schema mapping to the given solution mapping, which is assumed to use the global schema for the vocabulary terms that it binds to its query variables. If this schema mapping is not relevant for anything mentioned in the given solution mapping (i.e., applying this schema 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 interfaceSchemaMapping
-
applyInverseToSolutionMapping
Description copied from interface:SchemaMappingApplies the inverse of this schema mapping to the given solution mapping, which is assumed to use the local schema for the vocabulary terms that it binds to its query variables. If this schema mapping is not relevant for anything mentioned in the given solution mapping (i.e., applying the inverse of this schema 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 interfaceSchemaMapping
-
applyToSolutionMapping
-
rewriteComparison
protected org.apache.jena.sparql.expr.Expr rewriteComparison(org.apache.jena.sparql.expr.Expr expr, boolean useInverse) -
expandExpression
public List<org.apache.jena.sparql.expr.Expr> expandExpression(org.apache.jena.sparql.expr.Expr e, boolean useInverse) Expands the given expression according to a schema 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
-
extractGlobalTermsForLocalTerm
protected Set<org.apache.jena.graph.Node> extractGlobalTermsForLocalTerm(Set<TermMapping> mappingsForTerm) -
extractLocalTermsForGlobalTerm
protected Set<org.apache.jena.graph.Node> extractLocalTermsForGlobalTerm(Set<TermMapping> mappingsForTerm)
-