Class AccJsonFragmentHead

java.lang.Object
org.aksw.jenax.io.json.accumulator.AccJsonBase
org.aksw.jenax.io.json.accumulator.AccJsonFragmentHead
All Implemented Interfaces:
AccJson, AccJsonEdge

public class AccJsonFragmentHead extends AccJsonBase implements 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 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

      protected AccJsonNode 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()
      Specified by:
      getPath in interface AccJson
    • getJsonKey

      public org.apache.jena.sparql.path.P_Path0 getJsonKey()
      Specified by:
      getJsonKey in interface AccJsonEdge
    • getMatchFieldId

      public org.apache.jena.graph.Node getMatchFieldId()
      Specified by:
      getMatchFieldId in interface AccJsonEdge
    • 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:
      begin in interface AccJson
      Overrides:
      begin in class AccJsonBase
      Parameters:
      node - The source node to which the next incoming edge(s) will connect to
      context - The context which holds the JSON serializers
      skipOutput - 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:
      transition in interface AccJson
      Throws:
      IOException
    • end

      public void end(AccContextRdf context) throws IOException
      Description copied from interface: AccJson
      End the accumulator's current node
      Specified by:
      end in interface AccJson
      Overrides:
      end in class AccJsonBase
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • acceptContribution

      public void acceptContribution(RdfElement item, AccContextRdf context)
      Description copied from interface: AccJson
      For 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:
      acceptContribution in interface AccJson
    • isForward

      public boolean isForward()
      Specified by:
      isForward in interface AccJsonEdge