protected SesameConnectionBackend(RepositoryConnection connection, boolean includeInferred, Resource... contexts) { this.connection = connection; this.contexts = contexts; this.valueFactory = connection.getValueFactory(); this.includeInferred = includeInferred; }
protected SesameConnectionBackend(RepositoryConnection connection, boolean includeInferred, Resource... contexts) { this.connection = connection; this.contexts = contexts; this.valueFactory = connection.getValueFactory(); this.includeInferred = includeInferred; }
/** * Remove one of the RDF types of this Resource. For all spaces/context * * @param typeUri a URI resource representing the type of this Resource */ public static boolean hasType(RepositoryConnection con, Resource r, String typeUri) throws RepositoryException { return hasType(con,r,con.getValueFactory().createURI(typeUri)); }
/** * Check whether the uri is ever used as subject. * @param conn connection with the repository * @param uri uri of the resource to check * @return true if the uri is ever used as subject. */ public static boolean isSubject(RepositoryConnection conn, String uri) { return isSubject(conn, conn.getValueFactory().createURI(uri)); }
/** * Check whether the uri is ever used as predicate. * @param conn connection with the repository * @param uri uri of the resource to check * @return true if the uri is ever used as predicate. */ public static boolean isPredicate(RepositoryConnection conn, final String uri) { return isPredicate(conn, conn.getValueFactory().createURI(uri)); }
/** * Check whether the uri is ever used as object. * @param conn connection with the repository * @param uri uri of the resource to check * @return true if the uri is ever used as predicate. */ public static boolean isObject(RepositoryConnection conn, final String uri) { return isObject(conn, conn.getValueFactory().createURI(uri)); }
/** * Check whether the uri is ever used as context. * @param conn connection with the repository * @param uri uri of the resource to check * @return true if the uri is ever used as context. */ public static boolean isContext(RepositoryConnection conn, String uri) { return isContext(conn, conn.getValueFactory().createURI(uri)); }
/** * List all resources of a specific type contained in a certain knowledge space in the KiWi system * * @param context the resource identifying the knowledge space * @param type the type of the resources to list * @return */ public static Iterable<Resource> listResources(final RepositoryConnection con, final Resource type, final URI context) { URI rdf_type = con.getValueFactory().createURI(Namespaces.NS_RDF + "type"); return listSubjectsInternal(con, rdf_type, type, context); }
private void doDelete(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI context = vf.createURI("context:loop:" + loop + ":item:" + index); final Collection<Statement> statements = getStatementsForContext(conn, context); for (Statement statement : statements) { conn.remove(statement, context); } }
public static void addOutgoingNode(RepositoryConnection con, Resource r, String propLabel, Value target, URI context) throws RepositoryException { final Resource[] contexts; if(context != null) { contexts = new Resource[] { context }; } else { contexts = new Resource[0]; } String property_uri = resolvePropLabel(con,propLabel); URI prop = con.getValueFactory().createURI(property_uri); con.add(r,prop,target,contexts); }
@Override public Object execute(Object repository, Map<String, Object> operationParam) { String relationName = (String) operationParam.get("relationName"); Repository repo = (Repository) repository; try { repo.getConnection().remove((Resource)null, repo.getConnection().getValueFactory().createURI(relationName), (Resource)null,(Resource)null); } catch (Exception e) { return e; } return null; }
public SesameConnection(SesameRepository repository, RepositoryConnection connection, InferenceOptions inference, boolean serializeQueries) { this.repository = Assert.notNull(repository, "repository"); this.connection = Assert.notNull(connection, "connection"); this.vf = connection.getValueFactory(); this.dialect = new SesameDialect(vf); this.inference = inference; this.serializeQueries = serializeQueries; }
public SesameConnection(SesameRepository repository, RepositoryConnection connection, InferenceOptions inference) { this.repository = Assert.notNull(repository,"repository"); this.connection = Assert.notNull(connection,"connection"); this.vf = connection.getValueFactory(); this.dialect = new SesameDialect(vf); this.inference = Assert.notNull(inference,"inference"); }
public SesameConnection(SesameRepository repository, RepositoryConnection connection, InferenceOptions inference) { this.repository = Assert.notNull(repository, "repository"); this.connection = Assert.notNull(connection, "connection"); this.vf = connection.getValueFactory(); this.dialect = new SesameDialect(vf); this.inference = Assert.notNull(inference, "inference"); }
private void doInsert(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI c = vf.createURI("context:loop:" + loop + ":item:" + index); final URI s = vf.createURI("subject:loop:" + loop + ":item:" + index); for (int x = 0; x < NUM_STATEMENTS_PER_INSERT; ++x) { final URI p = vf.createURI("predicate:" + x); final Literal o = vf.createLiteral("SomeValue"); conn.add(s, p, o, c); } }
@Override public void storePerson(String personId, Iterable<String> contributionId) throws AnalysisException { ValueFactory vf = conn.getValueFactory(); for(String contrib : contributionId){ try { conn.add(vf.createURI(contrib),vf.createURI(getPersonPredicate()),vf.createURI(personId)); } catch (RepositoryException e) { throw new AnalysisException(e); } } }
private void doDelete(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI context = vf.createURI("context:loop:" + loop + ":item:" + index); final Collection<Statement> statements = getStatementsForContext(conn, context); for (Statement statement : statements) { conn.remove(statement, context); } }
private void populate(int n) throws RepositoryException { ValueFactory vf = con.getValueFactory(); for (int i = 0; i < n; i++) { con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node" + i)); } con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node-end")); }
private void doInsert(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI c = vf.createURI("context:loop:" + loop + ":item:" + index); final URI s = vf.createURI("subject:loop:" + loop + ":item:" + index); for (int x = 0; x < NUM_STATEMENTS_PER_INSERT; ++x) { final URI p = vf.createURI("predicate:" + x); final Literal o = vf.createLiteral("SomeValue"); conn.add(s, p, o, c); } }
private void populate(int n) throws RepositoryException { ValueFactory vf = con.getValueFactory(); for (int i = 0; i < n; i++) { con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node" + i)); } con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node-end")); }