Class JSON2SolutionGraphConverterImpl
java.lang.Object
se.liu.ida.hefquin.engine.wrappers.graphql.impl.JSON2SolutionGraphConverterImpl
- All Implemented Interfaces:
- JSON2SolutionGraphConverter
An implementation of the JSON2SolutionMappings approach
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final GraphQL2RDFConfigurationprotected final GraphQLSchema
- 
Constructor SummaryConstructorsConstructorDescriptionJSON2SolutionGraphConverterImpl(GraphQL2RDFConfiguration config, GraphQLSchema schema) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected org.apache.jena.rdf.model.LiteraljsonPrimitiveToLiteral(org.apache.jena.atlas.json.JsonValue primitive, String graphqlTypeName, String graphqlFieldName, org.apache.jena.rdf.model.Model model) Utility function used to create a Literal from a json value @param primitive usable by @param model.protected org.apache.jena.rdf.model.ResourceparseJSON(org.apache.jena.atlas.json.JsonObject root, Map<org.apache.jena.atlas.lib.PairOfSameType<String>, org.apache.jena.rdf.model.Resource> blankNodes, org.apache.jena.rdf.model.Model solutionGraph) Parses through a JsonObject recursively and expands @param blankNodes and @param solutionGraph.org.apache.jena.rdf.model.ModeltranslateJSON(org.apache.jena.atlas.json.JsonObject jsonObj) Translates a JSON object (obtained as a response to a GraphQL request) into a solution graph (model) containing triples created by parsing the JSON object.
- 
Field Details- 
config
- 
schema
 
- 
- 
Constructor Details- 
JSON2SolutionGraphConverterImpl
 
- 
- 
Method Details- 
translateJSONpublic org.apache.jena.rdf.model.Model translateJSON(org.apache.jena.atlas.json.JsonObject jsonObj) throws org.apache.jena.atlas.json.io.parserjavacc.javacc.ParseException, org.apache.jena.atlas.json.JsonException Description copied from interface:JSON2SolutionGraphConverterTranslates a JSON object (obtained as a response to a GraphQL request) into a solution graph (model) containing triples created by parsing the JSON object.- Specified by:
- translateJSONin interface- JSON2SolutionGraphConverter
- Throws:
- org.apache.jena.atlas.json.io.parserjavacc.javacc.ParseException- if the JSON structure for whatever reason isn't valid, thus making it un-parsable.
- org.apache.jena.atlas.json.JsonException
 
- 
parseJSONprotected org.apache.jena.rdf.model.Resource parseJSON(org.apache.jena.atlas.json.JsonObject root, Map<org.apache.jena.atlas.lib.PairOfSameType<String>, org.apache.jena.rdf.model.Resource> blankNodes, org.apache.jena.rdf.model.Model solutionGraph) throws org.apache.jena.atlas.json.io.parserjavacc.javacc.ParseException, org.apache.jena.atlas.json.JsonExceptionParses through a JsonObject recursively and expands @param blankNodes and @param solutionGraph.- Returns:
- a Resource in order to create a triple with the parent and the child resource.
- Throws:
- org.apache.jena.atlas.json.io.parserjavacc.javacc.ParseException- if the json object does not contain a valid "id" key.
- org.apache.jena.atlas.json.JsonException
 
- 
jsonPrimitiveToLiteralprotected org.apache.jena.rdf.model.Literal jsonPrimitiveToLiteral(org.apache.jena.atlas.json.JsonValue primitive, String graphqlTypeName, String graphqlFieldName, org.apache.jena.rdf.model.Model model) Utility function used to create a Literal from a json value @param primitive usable by @param model. @param graphqlTypeName and @param graphqlFieldName are used to fetch value type data from the GraphQL endpoint to ensure that the correct XML datatype is used when creating the literal.
 
-