All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.jenax.graphql.sparql.GraphQlExecBuilderOverSparql Maven / Gradle / Ivy

The newest version!
package org.aksw.jenax.graphql.sparql;

import java.util.Map;

import org.aksw.jenax.dataaccess.sparql.datasource.RdfDataSource;
import org.aksw.jenax.graphql.rdf.api.RdfGraphQlExec;

import graphql.language.Document;
import graphql.language.Value;

public class GraphQlExecBuilderOverSparql
    extends RdfGraphQlExecBuilderFront
{
    protected RdfDataSource dataSource;
    protected GraphQlToSparqlMappingFactory mappingFactory;

    public GraphQlExecBuilderOverSparql(RdfDataSource dataSource, GraphQlToSparqlMappingFactory mappingFactory) {
        super();
        this.dataSource = dataSource;
        this.mappingFactory = mappingFactory;
    }

    @Override
    public RdfGraphQlExec buildActual(Document document) {
        Map> map = GraphQlUtils.mapToGraphQl(assignments);

        GraphQlToSparqlMapping mapping = mappingFactory.newBuilder()
                // .setResolver(resolver)
                .setJsonMode(jsonMode)
                .setDocument(document)
                .setAssignments(map)
                .build();

        // GraphQlToSparqlMapping mapping = converter.convertDocument(document, map);
        RdfGraphQlExec result = new RdfGraphQlExecImpl(dataSource, mapping);
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy