/** * Throws an exception if the syntax is not SPARQL */ @Override public QueryResultTable querySelect(String query, String querylanguage) throws QueryLanguageNotSupportedException, ModelRuntimeException { assertModel(); if(querylanguage.equalsIgnoreCase("SPARQL")) return sparqlSelect(query); // else throw new QueryLanguageNotSupportedException("Unsupported query language: " + querylanguage); }
/** * Throws an exception if the syntax is not SPARQL */ public QueryResultTable querySelect(String query, String querylanguage) throws QueryLanguageNotSupportedException, ModelRuntimeException { assertModel(); if (querylanguage.equalsIgnoreCase("SPARQL")) return sparqlSelect(query); // else throw new QueryLanguageNotSupportedException( "Unsupported query language: " + querylanguage); }
public boolean sparqlAsk(String query) throws ModelRuntimeException, MalformedQueryException { QueryResultTable table = sparqlSelect(query); ClosableIterator<QueryRow> it = table.iterator(); boolean result = it.hasNext(); it.close(); return result; }
@Override public boolean sparqlAsk(String query) throws ModelRuntimeException, MalformedQueryException { QueryResultTable table = sparqlSelect(query); ClosableIterator<QueryRow> it = table.iterator(); boolean result = it.hasNext(); it.close(); return result; }
public Collection<Resource> getAllReificationsOf(Statement statement) { QueryResultTable table = this.sparqlSelect("SELECT ?res WHERE { " + " ?res " + RDF.type.toSPARQL() + " " + RDF.Statement + " ." + " ?res " + RDF.subject.toSPARQL() + " " + statement.getSubject().toSPARQL() + " ." + " ?res " + RDF.predicate.toSPARQL() + " " + statement.getPredicate().toSPARQL() + " ." + " ?res " + RDF.object.toSPARQL() + " " + statement.getObject().toSPARQL() + " ." + " }"); LinkedList<Resource> result = new LinkedList<Resource>(); ClosableIterator<QueryRow> it = table.iterator(); while (it.hasNext()) { Resource res = it.next().getValue("res").asResource(); result.add(res); } it.close(); return result; }
@Override public Collection<Resource> getAllReificationsOf(Statement statement) { QueryResultTable table = this.sparqlSelect("SELECT ?res WHERE { " + " ?res " + RDF.type.toSPARQL() + " " + RDF.Statement.toSPARQL() + " ." + " ?res " + RDF.subject.toSPARQL() + " " + statement.getSubject().toSPARQL() + " ." + " ?res " + RDF.predicate.toSPARQL() + " " + statement.getPredicate().toSPARQL() + " ." + " ?res " + RDF.object.toSPARQL() + " " + statement.getObject().toSPARQL() + " ." + " }"); LinkedList<Resource> result = new LinkedList<Resource>(); ClosableIterator<QueryRow> it = table.iterator(); while(it.hasNext()) { Resource res = it.next().getValue("res").asResource(); result.add(res); } it.close(); return result; }