Class GraphQlUtils
java.lang.Object
org.aksw.jenax.graphql.sparql.v2.util.GraphQlUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic graphql.language.DocumentapplyTransform(graphql.language.Document doc, graphql.language.NodeVisitorStub visitor) directivesSetterField(graphql.language.Field node) directivesSetterFieldDefinition(graphql.language.FieldDefinition node) static graphql.language.DirectiveexpectAtMostOneDirective(graphql.language.DirectivesContainer<?> container, String name) static graphql.language.ArgumentfindArgument(List<graphql.language.Argument> arguments, String name) static BooleangetArgAsBoolean(graphql.language.Directive directive, String argName) static BooleangetArgAsBoolean(graphql.language.Directive directive, String argName, Map<String, graphql.language.Value<?>> assignments) static LonggetArgAsLong(graphql.language.Field field, String name, Map<String, graphql.language.Value<?>> assignments) static LonggetArgAsLong(List<graphql.language.Argument> arguments, String name, Map<String, graphql.language.Value<?>> assignments) static StringgetArgAsString(graphql.language.Directive directive, String argName) getArgAsStrings(graphql.language.Directive directive, String argName) Expand strings to listsstatic graphql.language.Value<?>getArgValue(graphql.language.Directive directive, String argName) static StringgetArgValueAsString(graphql.language.Directive directive, String argName, Map<String, graphql.language.Value<?>> assignments) static Longstatic Numberstatic List<graphql.language.Directive>getQueryDirectives(graphql.language.Document document, String directiveName) static Stringstatic graphql.language.Value<?>getValue(graphql.language.Argument arg) static booleanhasQueryDirective(graphql.language.Document document, String directiveName) FIXME Update to the graphqls pecstatic graphql.com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexArguments(graphql.language.Field field) static graphql.com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexValues(graphql.language.ObjectValue field) mapToGraphQl(Map<String, org.apache.jena.graph.Node> assignments) static graphql.language.ArgumentnewArgBoolean(String name, Boolean value) static graphql.language.ArgumentnewArgString(String name, String value) static graphql.language.ArgumentnewArgString(String name, List<String> values) static graphql.language.DirectivenewDirective(String name, graphql.language.Argument... arguments) static voidprintln(PrintStream printStream, graphql.language.Document doc) static voidremoveDirectivesByName(Collection<graphql.language.Directive> directives, String name) static <T extends graphql.language.Node<T>>
TreplaceDirectives(T node, graphql.util.TraverserContext<graphql.language.Node> context, Function<T, Function<List<graphql.language.Directive>, T>> transform, List<graphql.language.Directive> remainingDirectives) static <T extends graphql.language.Node<T>>
TreplaceDirectivesOld(T node, graphql.util.TraverserContext<graphql.language.Node> context, BiFunction<T, List<graphql.language.Directive>, T> transform, LinkedList<graphql.language.Directive> remainingDirectives) Creates a copy of a node with the given list of directives.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.static graphql.language.ArrayValuetoArrayValue(List<String> strs) static BooleantoBoolean(graphql.language.Node<?> node) static LongtoLong(graphql.language.Node<?> node) static org.apache.jena.sparql.expr.NodeValuetoNodeValue(graphql.language.Node<?> node) Bridge graphql nodes to jena NodeValues (the latter has a nicer API)static NumbertoNumber(graphql.language.Node<?> node) static graphql.language.ScalarValue<?>toScalarValue(org.apache.jena.sparql.expr.NodeValue nv) static StringtoString(graphql.language.Node<?> node) static Optional<graphql.language.Node<?>>tryGetNode(graphql.language.Node<?> node, String... path)
-
Constructor Details
-
GraphQlUtils
public GraphQlUtils()
-
-
Method Details
-
replaceDirectivesOld
public static <T extends graphql.language.Node<T>> T replaceDirectivesOld(T node, graphql.util.TraverserContext<graphql.language.Node> context, BiFunction<T, List<graphql.language.Directive>, T> transform, LinkedList<graphql.language.Directive> remainingDirectives) Creates a copy of a node with the given list of directives. Returns the new node. replaceDirectives(node, context, (n, newDirectives) -> n.transform(builder -> builder.directives(newDirectives)), remainingDirectives) -
replaceDirectives
-
directivesSetterField
-
directivesSetterFieldDefinition
-
hasQueryDirective
FIXME Update to the graphqls pec -
getQueryDirectives
-
tryGetNode
-
getNumber
-
getLong
-
getString
-
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
-
getArgAsString
-
getArgAsStrings
Expand strings to lists -
toString
-
toBoolean
-
toNumber
-
toLong
-
indexArguments
public static graphql.com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexArguments(graphql.language.Field field) -
indexValues
public static graphql.com.google.common.collect.Multimap<String,graphql.language.Value<?>> indexValues(graphql.language.ObjectValue field) -
getValue
public static graphql.language.Value<?> getValue(graphql.language.Argument arg) -
getArgAsLong
-
getArgAsLong
-
findArgument
-
getArgValue
public static graphql.language.Value<?> getArgValue(graphql.language.Directive directive, String argName) -
getArgValueAsString
-
getArgAsBoolean
-
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
-
mapToJena
-
applyTransform
public static graphql.language.Document applyTransform(graphql.language.Document doc, graphql.language.NodeVisitorStub visitor) -
println
-
expectAtMostOneDirective
public static graphql.language.Directive expectAtMostOneDirective(graphql.language.DirectivesContainer<?> container, String name) -
toArrayValue
-
newArgString
-
newArgBoolean
-
newArgString
-
newDirective
public static graphql.language.Directive newDirective(String name, graphql.language.Argument... arguments) -
removeDirectivesByName
public static void removeDirectivesByName(Collection<graphql.language.Directive> directives, String name)
-