/** * * @param connection * @param name */ public NamedGraphContainer(URI uri) { super(); this.uri = uri; if(glitter==null) { ContainerEngineConfig config = new ContainerEngineConfig(this); glitter = new Engine(config); } }
public QueryResult executeQuery(Set<URI> defaultNamedGraphsIn, Set<URI> namedGraphsIn, String query) throws BocaException { try { HashSet<java.net.URI> defaultGraphs = new HashSet<java.net.URI>(), namedGraphs = new HashSet<java.net.URI>(); if (defaultNamedGraphsIn != null) for (URI g : defaultNamedGraphsIn) defaultGraphs.add(new java.net.URI(g.toString())); if (namedGraphsIn != null) for (URI g : namedGraphsIn) namedGraphs.add(new java.net.URI(g.toString())); UriGenerator.handleSpecialGraphUris(defaultGraphs,this); UriGenerator.handleSpecialGraphUris(namedGraphs,this); return new ContainerQueryResult(glitter.executeQuery(query, defaultGraphs, namedGraphs)); } catch (ParseException pe) { throw new RuntimeException(pe); } catch (GlitterException ge) { throw new RuntimeException(ge); } catch (URISyntaxException ge) { throw new RuntimeException(ge); } }
com.ibm.adtech.glitter.query.QueryResults results = null; try { results = glitter.executeQuery(query, defaultGraphs, namedGraphs); } finally { commit(); result = results.getAskResults(); } catch (ParseException e) { throw BocaException.createException(ExceptionConstants.SERVER.CODES.SEARCH_ERROR, ExceptionConstants.SERVER.SUBCODES.GLITTER_PARSE_EXCEPTION, e, query);
com.ibm.adtech.glitter.query.QueryResults results = glitter.executeQuery(query, defaultGraphs, namedGraphs); RDFXMLWriter writer = null; switch (results.getQueryController().getQueryType()) { case ASK : writer = new RDFXMLWriter(outputStream); writer.startRDF(); writer.handleStatement(Constants.valueFactory.createStatement(Constants.valueFactory.createBNode(), Predicates.SparqlQueryResults.BOOLEAN_TAG, Constants.valueFactory.createLiteral(results.getAskResults()))); writer.endRDF(); return QueryType.ASK.ordinal(); case CONSTRUCT : resultSet = results.getConstructResults(); writer = new RDFXMLWriter(outputStream); writer.startRDF(); return QueryType.CONSTRUCT.ordinal(); case DESCRIBE : resultSet = results.getDescribeResults(); writer = new RDFXMLWriter(outputStream); writer.startRDF(); return QueryType.DESCRIBE.ordinal(); case SELECT : Glitter2BocaResultSetAdaptor adaptor = new Glitter2BocaResultSetAdaptor(results, getNodeLayout()); return QueryType.SELECT.ordinal(); default : throw new GlitterException("Not a valid query type"); throw BocaException.createException(ExceptionConstants.SERVER.CODES.SEARCH_ERROR, ExceptionConstants.SERVER.SUBCODES.GLITTER_PARSE_EXCEPTION, e, query);
ds.addDefaultNamedGraph(ontGraph.getNamedGraphUri(), ontGraph); BasicGraphEngineConfig config = new BasicGraphEngineConfig(ds); Engine glitter = new Engine(config); try { QueryResults results = glitter.executeQuery(sparql, Collections.singleton(java.net.URI.create(ontGraph.getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) {
com.ibm.adtech.glitter.query.QueryResults results = glitter.executeQuery(query, defaultGraphs, namedGraphs); QueryResult qr = null; switch (results.getQueryController().getQueryType()) { case SELECT : qr = new QueryResult(new Glitter2BocaResultSetAdaptor(results, nodeLayout));
ds.addDefaultNamedGraph(ontGraph.getNamedGraphUri(), ontGraph); BasicGraphEngineConfig config = new BasicGraphEngineConfig(ds); Engine glitter = new Engine(config); try { QueryResults results = glitter.executeQuery(query, Collections.singleton(java.net.URI.create(ontGraph.getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) { QueryResults results = glitter.executeQuery(query, Collections.singleton(java.net.URI.create(ontGraph.getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) {
public Dataset() { BasicGraphEngineConfig config = new BasicGraphEngineConfig(this); glitter = new Engine(config); listener = new INamedGraphListener() { public void statementsDeleted(INamedGraph source, Statement... statements) { getEventManager().notifyDeleteStatements(statements); } public void statementsAdded(INamedGraph source, Statement... statements) { getEventManager().notifyAddStatements(statements); } public void notifyEvent(INamedGraph source, IEvent event) { getEventManager().notifyEvent(event); } }; }
private QueryResult query(Iterable<URI> defaultNamedGraphsIn, Iterable<URI> namedGraphsIn, String query) throws BocaException { try { Set<java.net.URI> dgs = new HashSet<java.net.URI>(); if (defaultNamedGraphsIn != null) { for (URI uri : defaultNamedGraphsIn) { dgs.add(java.net.URI.create(uri.toString())); } } Set<java.net.URI> ngs = new HashSet<java.net.URI>(); if (namedGraphsIn != null) { for (URI uri : namedGraphsIn) { ngs.add(java.net.URI.create(uri.toString())); } } QueryResults results = glitter.executeQuery(query, dgs, ngs); return new QueryResult(results); } catch (Exception e) { e.printStackTrace(); throw new JastorException(e, "Error querying for properties"); } }
ds.addDefaultNamedGraph(ontGraph.getNamedGraphUri(), ontGraph); BasicGraphEngineConfig config = new BasicGraphEngineConfig(ds); Engine glitter = new Engine(config); Restriction cardrestriction = null; try { QueryResults results = glitter.executeQuery(query,Collections.singleton(java.net.URI.create(ontGraph.getNamedGraphUri().toString())),Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) {
glitter = new Engine(config); initalizeConnection();
ds.addDefaultNamedGraph(clazz.graph().getNamedGraphUri(), clazz.graph()); BasicGraphEngineConfig config = new BasicGraphEngineConfig(ds); Engine glitter = new Engine(config); try { QueryResults results = glitter.executeQuery(query, Collections.singleton(java.net.URI.create(clazz.graph().getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) { QueryResults results = glitter.executeQuery(query, Collections.singleton(java.net.URI.create(clazz.graph().getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) {
ds.addDefaultNamedGraph(ontGraph.getNamedGraphUri(), ontGraph); BasicGraphEngineConfig config = new BasicGraphEngineConfig(ds); Engine glitter = new Engine(config); try { QueryResults results = glitter.executeQuery(query, Collections.singleton(java.net.URI.create(ontGraph.getNamedGraphUri().toString())), Collections.EMPTY_SET); Glitter2BasicResultSetAdaptor adaptor = new Glitter2BasicResultSetAdaptor(results); while (adaptor.hasNext()) {