Class TransformExpandShorthands

java.lang.Object
graphql.language.NodeVisitorStub
org.aksw.jenax.graphql.sparql.v2.rewrite.NodeVisitorPrefixesBase
org.aksw.jenax.graphql.sparql.v2.rewrite.TransformExpandShorthands
All Implemented Interfaces:
graphql.language.NodeVisitor

public class TransformExpandShorthands extends NodeVisitorPrefixesBase
Expands:
  • @prefix
  • @graph
  • @service
  • @vocab
  • @reverse
  • @iri
  • @source
  • @class
  • @emitRdfKey
Order of resolution:
  1. if vocab is given then build tentative field iri/li>
  2. if iri is given then override the field iri
  3. if class is given then use the field iri to build a @source directive
interplay of source and pattern: source would filter the sources of a given pattern. Expands
@rdf(iri: "rdfs:label") @reverse
into
@pattern(of: "?s rdfs:label ?o", src: 'o', tgt 's'} @emitRdfKey(iri: "rdfs:label", reverse: true)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static graphql.language.Directive
    newDirectivePattern(String effectiveIri, boolean isForward)
     
    static graphql.language.Directive
    newDirectivePattern(String pattern, String src, String tgt)
     
    static graphql.language.Directive
    newDirectiveSource(String effectiveIri)
     
    <T extends graphql.language.Node<T>>
    graphql.util.TraversalControl
    process(String nodeName, T node, graphql.language.DirectivesContainer<?> field, graphql.util.TraverserContext<graphql.language.Node> context, BiFunction<T,List<graphql.language.Directive>,T> transform)
     
    static String
    processVocab(graphql.language.DirectivesContainer<?> directives, graphql.util.TraverserContext<graphql.language.Node> context)
    Returns the vocab active for the given field.
    graphql.util.TraversalControl
    visitFieldActual(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitFieldDefinitionActual(graphql.language.FieldDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitFragmentSpreadActual(graphql.language.FragmentSpread node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitInlineFragmentActual(graphql.language.InlineFragment node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitInterfaceTypeDefinitionActual(graphql.language.InterfaceTypeDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     
    graphql.util.TraversalControl
    visitObjectTypeDefinitionActual(graphql.language.ObjectTypeDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
     

    Methods inherited from class graphql.language.NodeVisitorStub

    visitArgument, visitArrayValue, visitBooleanValue, visitDefinition, visitDirective, visitDirectiveDefinition, visitDirectiveLocation, visitDocument, visitEnumTypeDefinition, visitEnumValue, visitEnumValueDefinition, visitFloatValue, visitFragmentDefinition, visitInputObjectTypeDefinition, visitInputValueDefinition, visitIntValue, visitListType, visitNode, visitNonNullType, visitNullValue, visitObjectField, 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
  • Constructor Details

    • TransformExpandShorthands

      public TransformExpandShorthands()
  • Method Details

    • visitInlineFragmentActual

      public graphql.util.TraversalControl visitInlineFragmentActual(graphql.language.InlineFragment node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitInlineFragmentActual in class NodeVisitorPrefixesBase
    • visitFieldActual

      public graphql.util.TraversalControl visitFieldActual(graphql.language.Field field, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitFieldActual in class NodeVisitorPrefixesBase
    • visitFieldDefinitionActual

      public graphql.util.TraversalControl visitFieldDefinitionActual(graphql.language.FieldDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitFieldDefinitionActual in class NodeVisitorPrefixesBase
    • visitInterfaceTypeDefinitionActual

      public graphql.util.TraversalControl visitInterfaceTypeDefinitionActual(graphql.language.InterfaceTypeDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitInterfaceTypeDefinitionActual in class NodeVisitorPrefixesBase
    • visitObjectTypeDefinitionActual

      public graphql.util.TraversalControl visitObjectTypeDefinitionActual(graphql.language.ObjectTypeDefinition node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitObjectTypeDefinitionActual in class NodeVisitorPrefixesBase
    • process

      public <T extends graphql.language.Node<T>> graphql.util.TraversalControl process(String nodeName, T node, graphql.language.DirectivesContainer<?> field, graphql.util.TraverserContext<graphql.language.Node> context, BiFunction<T,List<graphql.language.Directive>,T> transform)
    • processVocab

      public static String processVocab(graphql.language.DirectivesContainer<?> directives, graphql.util.TraverserContext<graphql.language.Node> context)
      Returns the vocab active for the given field. Registers a present directive to the context.
    • newDirectiveSource

      public static graphql.language.Directive newDirectiveSource(String effectiveIri)
    • newDirectivePattern

      public static graphql.language.Directive newDirectivePattern(String effectiveIri, boolean isForward)
    • newDirectivePattern

      public static graphql.language.Directive newDirectivePattern(String pattern, String src, String tgt)
    • visitFragmentSpreadActual

      public graphql.util.TraversalControl visitFragmentSpreadActual(graphql.language.FragmentSpread node, graphql.util.TraverserContext<graphql.language.Node> context)
      Specified by:
      visitFragmentSpreadActual in class NodeVisitorPrefixesBase