Package org.topbraid.shacl.expr.lib
Class PathExpression
- java.lang.Object
-
- org.topbraid.shacl.expr.AbstractNodeExpression
-
- org.topbraid.shacl.expr.ComplexNodeExpression
-
- org.topbraid.shacl.expr.AbstractInputExpression
-
- org.topbraid.shacl.expr.lib.PathExpression
-
- All Implemented Interfaces:
NodeExpression
public class PathExpression extends AbstractInputExpression
-
-
Constructor Summary
Constructors Constructor Description PathExpression(org.apache.jena.rdf.model.RDFNode expr, org.apache.jena.rdf.model.Resource path, NodeExpression input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode>eval(org.apache.jena.rdf.model.RDFNode focusNode, NodeExpressionContext context)Produces an iterator of value nodes for a given focus node.org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode>evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context)Produces an iterator of focus nodes for a given value node.List<String>getFunctionalSyntaxArguments()org.apache.jena.sparql.path.PathgetJenaPath()org.apache.jena.rdf.model.ResourcegetOutputShape(org.apache.jena.rdf.model.Resource contextShape)Gets the shape of the output data (if known), based on a context shape.org.apache.jena.rdf.model.ResourcegetPath()org.apache.jena.rdf.model.PropertygetPredicate()StringgetTypeId()booleanisMaybeInferred(ShapesGraph shapesGraph)booleanisReversible(NodeExpressionContext context)Checks if this expression could be evaluated in the reverse direction, with a value given and then finding all focus nodes.voidvisit(NodeExpressionVisitor visitor)-
Methods inherited from class org.topbraid.shacl.expr.AbstractInputExpression
evalInput, getInput, getInputExpressions
-
Methods inherited from class org.topbraid.shacl.expr.ComplexNodeExpression
getFunctionalSyntax, getFunctionalSyntaxName
-
Methods inherited from class org.topbraid.shacl.expr.AbstractNodeExpression
getRDFNode, toString
-
-
-
-
Constructor Detail
-
PathExpression
public PathExpression(org.apache.jena.rdf.model.RDFNode expr, org.apache.jena.rdf.model.Resource path, NodeExpression input)
-
-
Method Detail
-
eval
public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> eval(org.apache.jena.rdf.model.RDFNode focusNode, NodeExpressionContext context)Description copied from interface:NodeExpressionProduces an iterator of value nodes for a given focus node.- Parameters:
focusNode- the focus nodecontext- the context- Returns:
- an iterator (never null)
-
evalReverse
public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context)Description copied from interface:NodeExpressionProduces an iterator of focus nodes for a given value node. This operation can only be called for node expressions where isReversible returns true and may throw an IllegalStateException otherwise.- Specified by:
evalReversein interfaceNodeExpression- Overrides:
evalReversein classAbstractNodeExpression- Parameters:
valueNode- the value nodecontext- the context- Returns:
- an iterator (never null)
-
getJenaPath
public org.apache.jena.sparql.path.Path getJenaPath()
-
getPredicate
public org.apache.jena.rdf.model.Property getPredicate()
-
getFunctionalSyntaxArguments
public List<String> getFunctionalSyntaxArguments()
- Overrides:
getFunctionalSyntaxArgumentsin classAbstractInputExpression
-
getOutputShape
public org.apache.jena.rdf.model.Resource getOutputShape(org.apache.jena.rdf.model.Resource contextShape)
Description copied from interface:NodeExpressionGets the shape of the output data (if known), based on a context shape. For example, for a path expression it would try to infer the output shape from the sh:class or sh:node of the property (path).- Specified by:
getOutputShapein interfaceNodeExpression- Overrides:
getOutputShapein classAbstractNodeExpression- Parameters:
contextShape- the shape where the evaluation would start, e.g. the node shape of the sh:values statement- Returns:
- an output shape or null if unknown
-
getPath
public org.apache.jena.rdf.model.Resource getPath()
-
getTypeId
public String getTypeId()
-
isMaybeInferred
public boolean isMaybeInferred(ShapesGraph shapesGraph)
-
isReversible
public boolean isReversible(NodeExpressionContext context)
Description copied from interface:NodeExpressionChecks if this expression could be evaluated in the reverse direction, with a value given and then finding all focus nodes. The function evalReverse can then be called. NOTE THAT THIS IS CURRENTLY BARELY IMPLEMENTED.- Specified by:
isReversiblein interfaceNodeExpression- Overrides:
isReversiblein classAbstractNodeExpression- Parameters:
context- the context- Returns:
- true if reversible
-
visit
public void visit(NodeExpressionVisitor visitor)
-
-