Class GraphQlToSparqlConverterBase<K>

java.lang.Object
graphql.language.NodeVisitorStub
org.aksw.jenax.graphql.sparql.v2.rewrite.GraphQlToSparqlConverterBase<K>
All Implemented Interfaces:
graphql.language.NodeVisitor
Direct Known Subclasses:
GraphQlToSparqlConverterJson, GraphQlToSparqlConverterRon

public abstract class GraphQlToSparqlConverterBase<K> extends graphql.language.NodeVisitorStub
Checks for @pattern directives.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected Map<String,graphql.language.FragmentDefinition>
     
    protected RewriteResult<K>
     
    protected SchemaNavigator
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphQlToSparqlConverterBase(Map<String,graphql.language.FragmentDefinition> nameToFragment, SchemaNavigator schemaNavigator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Create an ElementTransform according to the specification of a GraphDirective instance.
    graphql.util.TraversalControl
    enterField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    enterQuery(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    protected AggStateBuilder<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node>
    getAggResult(graphql.util.TraverserContext<graphql.language.Node> context)
     
    protected AggStateBuilderTransitionBase<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node>
    getAggTransition(graphql.util.TraverserContext<graphql.language.Node> context)
     
     
    protected org.apache.jena.graph.Node
     
    graphql.util.TraversalControl
    leaveField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    leaveQuery(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    processCardinality(graphql.language.DirectivesContainer<?> directives, graphql.util.TraverserContext<graphql.language.Node> context)
    Get the effective cardinality; publish cascading cardinalities to the context.
    void
    processFieldOnEnter(graphql.language.Node<?> node, String nodeName, List<graphql.language.Argument> arguments, graphql.language.DirectivesContainer<?> directives, graphql.language.SelectionSet selectionSet, graphql.util.TraverserContext<graphql.language.Node> context)
     
    processGraph(graphql.language.DirectivesContainer<?> field, graphql.util.TraverserContext<graphql.language.Node> context)
    Returns a graph directive present on the current field.
    readStateId(graphql.language.DirectivesContainer<?> directives)
     
    protected void
    setAggResult(graphql.util.TraverserContext<graphql.language.Node> context, AggStateBuilder<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> aggStateBuilder)
     
    protected void
    setAggTransition(graphql.util.TraverserContext<graphql.language.Node> context, AggStateBuilderTransitionBase<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> aggStateBuilder)
     
    protected abstract K
    toKey(graphql.language.Field field)
     
    protected abstract K
    toKey(org.apache.jena.graph.Node node)
     
    graphql.util.TraversalControl
    visitDocument(graphql.language.Document node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitFragmentSpread(graphql.language.FragmentSpread node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitInlineFragment(graphql.language.InlineFragment node, graphql.util.TraverserContext<graphql.language.Node> context)
    The main conceptual difference between conventional fields and inline fragments is in the latter case the inline fragment overrides the join for the children.
    graphql.util.TraversalControl
    visitOperationDefinition(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     

    Methods inherited from class graphql.language.NodeVisitorStub

    visitArgument, visitArrayValue, visitBooleanValue, visitDefinition, visitDirective, visitDirectiveDefinition, visitDirectiveLocation, visitEnumTypeDefinition, visitEnumValue, visitEnumValueDefinition, visitFieldDefinition, visitFloatValue, visitFragmentDefinition, visitInputObjectTypeDefinition, visitInputValueDefinition, visitInterfaceTypeDefinition, visitIntValue, visitListType, visitNode, visitNonNullType, visitNullValue, visitObjectField, visitObjectTypeDefinition, visitObjectValue, visitOperationTypeDefinition, visitScalarTypeDefinition, visitSchemaDefinition, visitSelection, visitSelectionSet, visitStringValue, visitType, visitTypeDefinition, visitTypeName, visitUnionTypeDefinition, visitValue, visitVariableDefinition, visitVariableReference

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • GraphQlToSparqlConverterBase

      public GraphQlToSparqlConverterBase(Map<String,graphql.language.FragmentDefinition> nameToFragment, SchemaNavigator schemaNavigator)
  • Method Details

    • getRewriteResult

      public RewriteResult<K> getRewriteResult()
    • toKey

      protected abstract K toKey(graphql.language.Field field)
    • toKey

      protected abstract K toKey(org.apache.jena.graph.Node node)
    • globalIdToSparql

      protected org.apache.jena.graph.Node globalIdToSparql(String globalId)
    • visitField

      public graphql.util.TraversalControl visitField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitField in interface graphql.language.NodeVisitor
      Overrides:
      visitField in class graphql.language.NodeVisitorStub
    • readStateId

      public String readStateId(graphql.language.DirectivesContainer<?> directives)
    • enterQuery

      public graphql.util.TraversalControl enterQuery(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
    • leaveQuery

      public graphql.util.TraversalControl leaveQuery(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
    • visitOperationDefinition

      public graphql.util.TraversalControl visitOperationDefinition(graphql.language.OperationDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitOperationDefinition in interface graphql.language.NodeVisitor
      Overrides:
      visitOperationDefinition in class graphql.language.NodeVisitorStub
    • visitDocument

      public graphql.util.TraversalControl visitDocument(graphql.language.Document node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitDocument in interface graphql.language.NodeVisitor
      Overrides:
      visitDocument in class graphql.language.NodeVisitorStub
    • enterField

      public graphql.util.TraversalControl enterField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
    • processFieldOnEnter

      public void processFieldOnEnter(graphql.language.Node<?> node, String nodeName, List<graphql.language.Argument> arguments, graphql.language.DirectivesContainer<?> directives, graphql.language.SelectionSet selectionSet, graphql.util.TraverserContext<graphql.language.Node> context)
    • leaveField

      public graphql.util.TraversalControl leaveField(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
    • visitInlineFragment

      public graphql.util.TraversalControl visitInlineFragment(graphql.language.InlineFragment node, graphql.util.TraverserContext<graphql.language.Node> context)
      The main conceptual difference between conventional fields and inline fragments is in the latter case the inline fragment overrides the join for the children. The condition can access all variables declared in the parent.
      • Creates a separate ElementNode with the condition.
      • Inherits all variables of the parent
      Specified by:
      visitInlineFragment in interface graphql.language.NodeVisitor
      Overrides:
      visitInlineFragment in class graphql.language.NodeVisitorStub
    • setAggTransition

      protected void setAggTransition(graphql.util.TraverserContext<graphql.language.Node> context, AggStateBuilderTransitionBase<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> aggStateBuilder)
    • getAggTransition

      protected AggStateBuilderTransitionBase<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> getAggTransition(graphql.util.TraverserContext<graphql.language.Node> context)
    • setAggResult

      protected void setAggResult(graphql.util.TraverserContext<graphql.language.Node> context, AggStateBuilder<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> aggStateBuilder)
    • getAggResult

      protected AggStateBuilder<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> getAggResult(graphql.util.TraverserContext<graphql.language.Node> context)
    • visitFragmentSpread

      public graphql.util.TraversalControl visitFragmentSpread(graphql.language.FragmentSpread node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitFragmentSpread in interface graphql.language.NodeVisitor
      Overrides:
      visitFragmentSpread in class graphql.language.NodeVisitorStub
    • processCardinality

      public static CardinalityDirective processCardinality(graphql.language.DirectivesContainer<?> directives, graphql.util.TraverserContext<graphql.language.Node> context)
      Get the effective cardinality; publish cascading cardinalities to the context.
    • processGraph

      public static GraphDirective processGraph(graphql.language.DirectivesContainer<?> field, graphql.util.TraverserContext<graphql.language.Node> context)
      Returns a graph directive present on the current field. Also registers such present directive at the context for reference. Note: Only directives present on the current field are relevant for processing because only from those are ElementTransforms created.
    • convert

      public static ElementTransform convert(GraphDirective graph)
      Create an ElementTransform according to the specification of a GraphDirective instance.