@Test public void testGetStatements() throws Exception{ File inputFile = new File(TESTFILE_OWL); conn.add(inputFile,null,RDFFormat.RDFXML); ValueFactory f= conn.getValueFactory(); URI subj = f.createURI("http: RepositoryResult<Statement> statements = conn.getStatements(subj, null, null, true); Assert.assertTrue(statements.hasNext()); conn.clear(conn.getValueFactory().createURI("http: }
public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException { try { if (isQuadMode()) { TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS); setBindings(tupleQuery, subj, pred, obj); tupleQuery.setIncludeInferred(includeInferred); TupleQueryResult qRes = tupleQuery.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>( toStatementIteration(qRes, subj, pred, obj)) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } else if (subj != null && pred != null && obj != null) { if (hasStatement(subj, pred, obj, includeInferred)) { Statement st = new StatementImpl(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } } GraphQuery query = prepareGraphQuery(EVERYTHING); setBindings(query, subj, pred, obj); GraphQueryResult result = query.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(result) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
MarkLogicRepositoryConnection extends RepositoryConnectionBase implements RepositoryConnection,MarkLogicRepositoryConnectionDependent { public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException { try { if (isQuadMode()) { TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS); setBindings(tupleQuery, subj, pred, obj); tupleQuery.setIncludeInferred(includeInferred); TupleQueryResult qRes = tupleQuery.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>( toStatementIteration(qRes, subj, pred, obj)) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } else if (subj != null && pred != null && obj != null) { if (hasStatement(subj, pred, obj, includeInferred)) { Statement st = new StatementImpl(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } } GraphQuery query = prepareGraphQuery(EVERYTHING); setBindings(query, subj, pred, obj); GraphQueryResult result = query.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(result) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } } }
MarkLogicRepositoryConnection extends RepositoryConnectionBase implements RepositoryConnection,MarkLogicRepositoryConnectionDependent { public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException { try { if (isQuadMode()) { TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS); setBindings(tupleQuery, subj, pred, obj); tupleQuery.setIncludeInferred(includeInferred); TupleQueryResult qRes = tupleQuery.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>( toStatementIteration(qRes, subj, pred, obj)) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } else if (subj != null && pred != null && obj != null) { if (hasStatement(subj, pred, obj, includeInferred)) { Statement st = new StatementImpl(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } } GraphQuery query = prepareGraphQuery(EVERYTHING); setBindings(query, subj, pred, obj); GraphQueryResult result = query.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(result) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } } MarkLogicRepositoryConnection(MarkLogicRepository repository, MarkLogicClient client, boolean quadMode); }
MarkLogicRepositoryConnection extends RepositoryConnectionBase implements RepositoryConnection,MarkLogicRepositoryConnectionDependent { public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException { try { if (isQuadMode()) { TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS); setBindings(tupleQuery, subj, pred, obj); tupleQuery.setIncludeInferred(includeInferred); TupleQueryResult qRes = tupleQuery.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>( toStatementIteration(qRes, subj, pred, obj)) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } else if (subj != null && pred != null && obj != null) { if (hasStatement(subj, pred, obj, includeInferred)) { Statement st = new StatementImpl(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } } GraphQuery query = prepareGraphQuery(EVERYTHING); setBindings(query, subj, pred, obj); GraphQueryResult result = query.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(result) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } } MarkLogicRepositoryConnection(MarkLogicRepository repository, MarkLogicClient client, boolean quadMode); @Override ValueFactory getValueFactory(); void setValueFactory(ValueFactory f); @Override /** * Releases the connection to the database. Ensures that open transactions * are complete. Stops write cache Timer. */ void close(); @Override Query prepareQuery(String queryString); @Override Query prepareQuery(String queryString, String baseURI); @Override Query prepareQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString,String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString,String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString,String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(String queryString); @Override MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI); @Override RepositoryResult<Resource> getContextIDs(); RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred); @Override RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Resource subject, URI predicate, Value object, boolean includeInferred, Resource... contexts); @Override void export(RDFHandler handler, Resource... contexts); @Override void exportStatements(Resource subject, URI predicate, Value object, boolean includeInferred, RDFHandler handler, Resource... contexts); @Override long size(); @Override long size(Resource... contexts); @Override void clear(); @Override void clear(Resource... contexts); @Override boolean isEmpty(); @Override boolean isOpen(); @Override boolean isActive(); @Override IsolationLevel getIsolationLevel(); @Override void setIsolationLevel(IsolationLevel level); @Override void begin(); @Override void begin(IsolationLevel level); @Override void commit(); @Override void rollback(); @Override void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Resource subject, URI predicate, Value object, Resource... contexts); @Override void add(Statement st, Resource... contexts); @Override void add(Iterable<? extends Statement> statements, Resource... contexts); @Override void add(Iteration<? extends Statement, E> statements, Resource... contexts); @Override void remove(Resource subject, URI predicate, Value object, Resource... contexts); @Override void remove(Statement st, Resource... contexts); @Override void remove(Iterable<? extends Statement> statements); @Override void remove(Iterable<? extends Statement> statements, Resource... contexts); @Override void remove(Iteration<? extends Statement, E> statements); @Override void remove(Iteration<? extends Statement, E> statements, Resource... contexts); @Override RepositoryResult<Namespace> getNamespaces(); @Override String getNamespace(String prefix); @Override void setNamespace(String prefix, String name); @Override void removeNamespace(String prefix); @Override void clearNamespaces(); @Override void setDefaultGraphPerms(GraphPermissions graphPerms); @Override GraphPermissions getDefaultGraphPerms(); @Override void setDefaultConstrainingQueryDefinition(QueryDefinition queryDef); @Override QueryDefinition getDefaultConstrainingQueryDefinition(); @Override void setDefaultRulesets(SPARQLRuleset ... ruleset ); @Override SPARQLRuleset[] getDefaultRulesets(); @Override void sync(); @Override void configureWriteCache(long initDelay, long delayCache, long cacheSize); }
MarkLogicRepositoryConnection extends RepositoryConnectionBase implements RepositoryConnection,MarkLogicRepositoryConnectionDependent { public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException { try { if (isQuadMode()) { TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS); setBindings(tupleQuery, subj, pred, obj); tupleQuery.setIncludeInferred(includeInferred); TupleQueryResult qRes = tupleQuery.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>( toStatementIteration(qRes, subj, pred, obj)) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } else if (subj != null && pred != null && obj != null) { if (hasStatement(subj, pred, obj, includeInferred)) { Statement st = new StatementImpl(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } } GraphQuery query = prepareGraphQuery(EVERYTHING); setBindings(query, subj, pred, obj); GraphQueryResult result = query.evaluate(); return new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(result) { @Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } }); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } } MarkLogicRepositoryConnection(MarkLogicRepository repository, MarkLogicClient client, boolean quadMode); @Override ValueFactory getValueFactory(); void setValueFactory(ValueFactory f); @Override /** * Releases the connection to the database. Ensures that open transactions * are complete. Stops write cache Timer. */ void close(); @Override Query prepareQuery(String queryString); @Override Query prepareQuery(String queryString, String baseURI); @Override Query prepareQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString,String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString,String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString,String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(String queryString); @Override MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI); @Override RepositoryResult<Resource> getContextIDs(); RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred); @Override RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Resource subject, URI predicate, Value object, boolean includeInferred, Resource... contexts); @Override void export(RDFHandler handler, Resource... contexts); @Override void exportStatements(Resource subject, URI predicate, Value object, boolean includeInferred, RDFHandler handler, Resource... contexts); @Override long size(); @Override long size(Resource... contexts); @Override void clear(); @Override void clear(Resource... contexts); @Override boolean isEmpty(); @Override boolean isOpen(); @Override boolean isActive(); @Override IsolationLevel getIsolationLevel(); @Override void setIsolationLevel(IsolationLevel level); @Override void begin(); @Override void begin(IsolationLevel level); @Override void commit(); @Override void rollback(); @Override void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Resource subject, URI predicate, Value object, Resource... contexts); @Override void add(Statement st, Resource... contexts); @Override void add(Iterable<? extends Statement> statements, Resource... contexts); @Override void add(Iteration<? extends Statement, E> statements, Resource... contexts); @Override void remove(Resource subject, URI predicate, Value object, Resource... contexts); @Override void remove(Statement st, Resource... contexts); @Override void remove(Iterable<? extends Statement> statements); @Override void remove(Iterable<? extends Statement> statements, Resource... contexts); @Override void remove(Iteration<? extends Statement, E> statements); @Override void remove(Iteration<? extends Statement, E> statements, Resource... contexts); @Override RepositoryResult<Namespace> getNamespaces(); @Override String getNamespace(String prefix); @Override void setNamespace(String prefix, String name); @Override void removeNamespace(String prefix); @Override void clearNamespaces(); @Override void setDefaultGraphPerms(GraphPermissions graphPerms); @Override GraphPermissions getDefaultGraphPerms(); @Override void setDefaultConstrainingQueryDefinition(QueryDefinition queryDef); @Override QueryDefinition getDefaultConstrainingQueryDefinition(); @Override void setDefaultRulesets(SPARQLRuleset ... ruleset ); @Override SPARQLRuleset[] getDefaultRulesets(); @Override void sync(); @Override void configureWriteCache(long initDelay, long delayCache, long cacheSize);  }