Class GraphQlUtils

java.lang.Object
org.aksw.jenax.graphql.sparql.GraphQlUtils

public class GraphQlUtils extends Object
  • Constructor Details

    • GraphQlUtils

      public GraphQlUtils()
  • Method Details

    • isValidCharForFieldName

      public static boolean isValidCharForFieldName(int ch)
      FIXME Update to the graphqls pec
    • safeFieldName

      public static String safeFieldName(String name)
      Replaces any invalid char with '_' and returns null on empty string
    • tryGetNode

      public static Optional<graphql.language.Node<?>> tryGetNode(graphql.language.Node<?> node, String... path)
    • getNumber

      public static Number getNumber(graphql.language.Node<?> node, String... path)
    • getLong

      public static Long getLong(graphql.language.Node<?> node, String... path)
    • getString

      public static String getString(graphql.language.Node<?> node, String... path)
    • toNodeValue

      public static org.apache.jena.sparql.expr.NodeValue toNodeValue(graphql.language.Node<?> node)
      Bridge graphql nodes to jena NodeValues (the latter has a nicer API)
    • toScalarValue

      public static graphql.language.ScalarValue<?> toScalarValue(org.apache.jena.sparql.expr.NodeValue nv)
    • getArgAsBoolean

      public static Boolean getArgAsBoolean(graphql.language.Directive directive, String argName)
    • getArgAsString

      public static String getArgAsString(graphql.language.Directive directive, String argName)
    • getArgAsStrings

      public static List<String> getArgAsStrings(graphql.language.Directive directive, String argName)
      Expand strings to lists
    • toString

      public static String toString(graphql.language.Node<?> node)
    • toBoolean

      public static Boolean toBoolean(graphql.language.Node<?> node)
    • toNumber

      public static Number toNumber(graphql.language.Node<?> node)
    • toLong

      public static Long toLong(graphql.language.Node<?> node)
    • indexArguments

      public static com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexArguments(graphql.language.Field field)
    • indexValues

      public static com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexValues(graphql.language.ObjectValue field)
    • getArgumentValue

      public static graphql.language.Value<?> getArgumentValue(com.google.common.collect.Multimap<String,graphql.language.Value<?>> args, String argName)
    • getArgumentValue

      public static graphql.language.Value<?> getArgumentValue(com.google.common.collect.Multimap<String,graphql.language.Value<?>> args, String argName, Map<String,graphql.language.Value<?>> assignments)
    • tryGetArgumentValue

      public static Optional<graphql.language.Value<?>> tryGetArgumentValue(com.google.common.collect.Multimap<String,graphql.language.Value<?>> args, String argName)
    • getValue

      public static graphql.language.Value<?> getValue(graphql.language.Argument arg)
    • indexFields

      public static org.aksw.facete.v3.api.TreeDataMap<org.aksw.commons.path.core.Path<String>,graphql.language.Field> indexFields(graphql.language.SelectionSet selectionSet)
    • indexFields

      public static void indexFields(org.aksw.facete.v3.api.TreeDataMap<org.aksw.commons.path.core.Path<String>,graphql.language.Field> tree, org.aksw.commons.path.core.Path<String> path, graphql.language.SelectionSet selection)
    • getArgAsLong

      public static Long getArgAsLong(graphql.language.Field field, String name, Map<String,graphql.language.Value<?>> assignments)
    • getArgAsLong

      public static Long getArgAsLong(List<graphql.language.Argument> arguments, String name, Map<String,graphql.language.Value<?>> assignments)
    • findArgument

      public static graphql.language.Argument findArgument(List<graphql.language.Argument> arguments, String name)
    • getArgValue

      public static graphql.language.Value<?> getArgValue(graphql.language.Directive directive, String argName)
    • getArgValueAsString

      public static String getArgValueAsString(graphql.language.Directive directive, String argName, Map<String,graphql.language.Value<?>> assignments)
    • getArgAsBoolean

      public static Boolean getArgAsBoolean(graphql.language.Directive directive, String argName, Map<String,graphql.language.Value<?>> assignments)
    • indexField

      public static void indexField(org.aksw.facete.v3.api.TreeDataMap<org.aksw.commons.path.core.Path<String>,graphql.language.Field> tree, org.aksw.commons.path.core.Path<String> path, graphql.language.Field field)
    • resolveValue

      public static graphql.language.Value<?> resolveValue(graphql.language.Value<?> value, Map<String,graphql.language.Value<?>> assignments)
      Resolves variable references once against the given map of assignments. Null if there is no assignment.
    • mapToGraphQl

      public static Map<String,graphql.language.Value<?>> mapToGraphQl(Map<String,org.apache.jena.graph.Node> assignments)
    • mapToJena

      public static Map<String,org.apache.jena.graph.Node> mapToJena(Map<String,graphql.language.Value<?>> assignments)
    • applyTransform

      public static graphql.language.Document applyTransform(graphql.language.Document doc, graphql.language.NodeVisitorStub visitor)
    • expectAtMostOneDirective

      public static graphql.language.Directive expectAtMostOneDirective(graphql.language.DirectivesContainer<?> container, String name)
    • toArrayValue

      public static graphql.language.ArrayValue toArrayValue(List<String> strs)