java.lang.Object
org.apache.jena.reasoner.rulesys.Functor
- All Implemented Interfaces:
ClauseEntry
A functor comprises a functor name and a list of
arguments. The arguments are Nodes of any type except functor nodes
(there is no functor nesting). Functors play three roles in rules -
in heads they represent actions (procedural attachment); in bodies they
represent builtin predicates; in TriplePatterns they represent embedded
structured literals that are used to cache matched subgraphs such as
restriction specifications.
-
Field Summary
Modifier and TypeFieldDescriptionA static Predicate instance that detects triples with Functor objects -
Constructor Summary
ConstructorDescriptionConstructorFunctor
(String name, List<Node> args, BuiltinRegistry registry) ConstructorConstructor.ConstructorFunctor
(String name, Node[] args, BuiltinRegistry registry) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
Equality is based on structural comparisonboolean
evalAsBodyClause
(RuleContext context) Execute the given built in as a body clause.int
Return the length of the functor argument array.Node[]
getArgs()
Return the functor arguments as an array of nodesNode[]
Return a new Node array containing the bound versions of this Functor's argumentsReturn the Builtin that implements this functorgetName()
Return the functor nameint
hashCode()
hash function overridestatic boolean
tests that a given Node represents a functorboolean
isGround()
Returns true if the functor is fully ground, no variablesboolean
Returns true if the functor is fully ground in the given environmentstatic Node
makeFunctorNode
(String name, Node[] args) Create a functor and wrap it up as a Literal nodestatic Node
Wrap a functor as a Literal nodeboolean
safeEvalAsBodyClause
(RuleContext context) Execute the given built in as a body clause, only if it is side-effect-free.boolean
Compare Functors, taking into account variable indices.void
setImplementor
(Builtin implementor) Set the Builtin that implements this functor.toString()
Printable string describing the functor
-
Field Details
-
acceptFilter
A static Predicate instance that detects triples with Functor objects
-
-
Constructor Details
-
Functor
Constructor.- Parameters:
name
- the name of the functorargs
- an array of nodes defining the arguments, this will not be copied so beware of accidental structure sharing
-
Functor
Constructor- Parameters:
name
- the name of the functorargs
- a list of nodes defining the argumentsregistry
- a table of builtins to consult to check for implementations of this functor when used as a rule clause
-
Functor
Constructor- Parameters:
name
- the name of the functorargs
- an array of nodes defining the argumentsregistry
- a table of builtins to consult to check for implementations of this functor when used as a rule clause
-
Functor
Constructor- Parameters:
name
- the name of the functorargs
- a list of nodes defining the argumentsimpl
- a specific builtin implementation of this functor
-
Functor
Constructor- Parameters:
name
- the name of the functorargs
- a list of nodes defining the argumentsimpl
- a specific builtin implementation of this functor
-
-
Method Details
-
getName
Return the functor name -
getArgs
Return the functor arguments as an array of nodes -
getArgLength
public int getArgLength()Return the length of the functor argument array. -
isGround
public boolean isGround()Returns true if the functor is fully ground, no variables -
isGround
Returns true if the functor is fully ground in the given environment -
evalAsBodyClause
Execute the given built in as a body clause.- Parameters:
context
- an execution context giving access to other relevant data- Returns:
- true if the functor has an implementation and that implementation returns true when evaluated
-
safeEvalAsBodyClause
Execute the given built in as a body clause, only if it is side-effect-free.- Parameters:
context
- an execution context giving access to other relevant data- Returns:
- true if the functor has an implementation and that implementation returns true when evaluated
-
getBoundArgs
Return a new Node array containing the bound versions of this Functor's arguments -
getImplementor
Return the Builtin that implements this functor- Returns:
- the Builtin or null if there isn't one
-
setImplementor
Set the Builtin that implements this functor. -
toString
Printable string describing the functor -
isFunctor
tests that a given Node represents a functor -
equals
Equality is based on structural comparison -
hashCode
public int hashCode()hash function override -
sameAs
Compare Functors, taking into account variable indices. The equality function ignores differences between variables.- Specified by:
sameAs
in interfaceClauseEntry
-
makeFunctorNode
Create a functor and wrap it up as a Literal node- Parameters:
name
- the name of the functorargs
- an array of nodes defining the arguments, this will not be copied so beware of accidental structure sharing
-
makeFunctorNode
Wrap a functor as a Literal node- Parameters:
f
- the functor data structure to be wrapped in a node.
-