@Override public Model execConstruct() { return execConstruct(GraphFactory.makeJenaDefaultModel()); }
@Override public void sparqlConstructQuery(String queryStr, Model model) throws RDFServiceException { QueryEngineHTTP qeh = new QueryEngineHTTP( readEndpointURI, queryStr); try { qeh.execConstruct(model); } finally { qeh.close(); } }
/** * Performs a SPARQL construct query against the knowledge base. The query may have * an embedded graph identifier. * * @param queryStr - the SPARQL query to be executed against the RDF store * @param resultFormat - type of serialization for RDF result of the SPARQL query */ @Override public InputStream sparqlConstructQuery(String queryStr, RDFServiceImpl.ModelSerializationFormat resultFormat) throws RDFServiceException { Model model = ModelFactory.createDefaultModel(); //Query query = QueryFactory.create(queryStr); //QueryExecution qe = QueryExecutionFactory.sparqlService(readEndpointURI, queryStr); QueryEngineHTTP qeh = new QueryEngineHTTP( readEndpointURI, queryStr); try { qeh.execConstruct(model); } finally { qeh.close(); } ByteArrayOutputStream serializedModel = new ByteArrayOutputStream(); model.write(serializedModel,getSerializationFormatString(resultFormat)); InputStream result = new ByteArrayInputStream(serializedModel.toByteArray()); return result; }
queryExecution.addNamedGraph(ngu); Model m2 = queryExecution.execConstruct();