Class AccJsonFragmentHead
java.lang.Object
org.aksw.jenax.io.json.accumulator.AccJsonBase
org.aksw.jenax.io.json.accumulator.AccJsonFragmentHead
- All Implemented Interfaces:
AccJson,AccJsonEdge
An accumulator for a conditional transition to the fragment body.
The fields of the body will only be instantiated if the head condition matches.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.jena.graph.Nodeprotected org.apache.jena.sparql.path.P_Path0protected booleanprotected org.apache.jena.graph.Nodeprotected longprotected booleanprotected AccJsonNodeFields inherited from class org.aksw.jenax.io.json.accumulator.AccJsonBase
currentSourceNode, hasBegun, oldSourceNode, parent, skipOutput, value -
Constructor Summary
ConstructorsConstructorDescriptionAccJsonFragmentHead(org.apache.jena.sparql.path.P_Path0 dummyJsonKey, org.apache.jena.graph.Node matchFieldId, boolean isForward, AccJsonNode targetAcc) If true then no array is created. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptContribution(RdfElement item, AccContextRdf context) For materialization: Whenever end() is called on a state with materialization enabled, then it passes its accumulated value to the parent using this method.voidbegin(org.apache.jena.graph.Node node, AccContextRdf context, boolean skipOutput) Sets the source node which subsequent triples must match in addition to the fieldId.voidend(AccContextRdf context) End the accumulator's current nodeorg.apache.jena.sparql.path.P_Path0org.apache.jena.graph.Nodeorg.aksw.commons.path.json.PathJsongetPath()booleantoString()transition(org.apache.jena.graph.Triple input, AccContextRdf context) Accepts a triple if source and field id match that of the current stateMethods inherited from class org.aksw.jenax.io.json.accumulator.AccJsonBase
ensureBegun, getInternalValue, getParent, getValue, hasBegun, setParent
-
Field Details
-
matchFieldId
protected org.apache.jena.graph.Node matchFieldId -
isForward
protected boolean isForward -
dummyJsonKey
protected org.apache.jena.sparql.path.P_Path0 dummyJsonKey -
currentTarget
protected org.apache.jena.graph.Node currentTarget -
targetAcc
-
skipOutputStartedHere
protected boolean skipOutputStartedHere -
seenTargetCount
protected long seenTargetCount
-
-
Constructor Details
-
AccJsonFragmentHead
public AccJsonFragmentHead(org.apache.jena.sparql.path.P_Path0 dummyJsonKey, org.apache.jena.graph.Node matchFieldId, boolean isForward, AccJsonNode targetAcc) If true then no array is created. Any item after the first raises an error event.
-
-
Method Details
-
getPath
public org.aksw.commons.path.json.PathJson getPath() -
getJsonKey
public org.apache.jena.sparql.path.P_Path0 getJsonKey()- Specified by:
getJsonKeyin interfaceAccJsonEdge
-
getMatchFieldId
public org.apache.jena.graph.Node getMatchFieldId()- Specified by:
getMatchFieldIdin interfaceAccJsonEdge
-
begin
public void begin(org.apache.jena.graph.Node node, AccContextRdf context, boolean skipOutput) throws IOException Sets the source node which subsequent triples must match in addition to the fieldId. This method should be called by the owner of the edge such as AccJsonObject.- Specified by:
beginin interfaceAccJson- Overrides:
beginin classAccJsonBase- Parameters:
node- The source node to which the next incoming edge(s) will connect tocontext- The context which holds the JSON serializersskipOutput- When output should be disabled (used e.g. to skip over lists of items where just one was expected)- Throws:
IOException
-
transition
public AccJson transition(org.apache.jena.graph.Triple input, AccContextRdf context) throws IOException Accepts a triple if source and field id match that of the current state- Specified by:
transitionin interfaceAccJson- Throws:
IOException
-
end
Description copied from interface:AccJsonEnd the accumulator's current node- Specified by:
endin interfaceAccJson- Overrides:
endin classAccJsonBase- Throws:
IOException
-
toString
-
acceptContribution
Description copied from interface:AccJsonFor materialization: Whenever end() is called on a state with materialization enabled, then it passes its accumulated value to the parent using this method.- Specified by:
acceptContributionin interfaceAccJson
-
isForward
public boolean isForward()- Specified by:
isForwardin interfaceAccJsonEdge
-