@Test public void Remove() { Set<STMT> additions = new HashSet<STMT>(); additions.add(new STMT(RDF.type, RDF.type, RDF.Property)); additions.add(new STMT(RDF.type, RDFS.label, new LIT("type"))); additions.add(new STMT(RDF.type, RDFS.label, new LIT("tyyppi", new Locale("fi")))); Set<STMT> removals = new HashSet<STMT>(); conn.update(removals, additions); QSymbol symbol = QSymbol.symbol; assertEquals(1l, from(symbol).where(symbol.id.eq(id(RDF.type))).count()); assertEquals(1l, from(symbol).where(symbol.id.eq(id(RDFS.label))).count()); assertEquals(1l, from(symbol).where(symbol.id.eq(id(new LIT("type")))).count()); conn.remove(null, null, null, RDF.type); assertEquals(3, conn.find(RDF.type, null, null, null, false).size()); conn.remove(null, null, RDF.Property, null); assertEquals(2, conn.find(RDF.type, null, null, null, false).size()); conn.remove(null, RDF.type, RDF.Property, null); assertEquals(2, conn.find(RDF.type, null, null, null, false).size()); conn.remove(RDF.type, RDF.type, RDF.Property, null); assertEquals(2, conn.find(RDF.type, null, null, null, false).size()); conn.remove(RDF.type, RDF.type, null, null); assertEquals(2, conn.find(RDF.type, null, null, null, false).size()); conn.remove(RDF.type, null, null, null); assertEquals(0, conn.find(RDF.type, null, null, null, false).size()); conn.remove(null, null, null, null); }
@Override public void remove(ID s, UID p, NODE o, UID c) { SQLDeleteClause delete = context.createDelete(statement); if (s != null) { delete.where(statement.subject.eq(getId(s))); } if (p != null) { delete.where(statement.predicate.eq(getId(p))); } if (o != null) { delete.where(statement.object.eq(getId(o))); } if (c != null) { delete.where(statement.model.eq(getId(c))); } delete.execute(); }
RDBConnection implements RDFConnection { @Override public void remove(ID s, UID p, NODE o, UID c) { SQLDeleteClause delete = context.createDelete(statement); if (s != null) { delete.where(statement.subject.eq(getId(s))); } if (p != null) { delete.where(statement.predicate.eq(getId(p))); } if (o != null) { delete.where(statement.object.eq(getId(o))); } if (c != null) { delete.where(statement.model.eq(getId(c))); } delete.execute(); } }
RDBConnection implements RDFConnection { @Override public void remove(ID s, UID p, NODE o, UID c) { SQLDeleteClause delete = context.createDelete(statement); if (s != null) { delete.where(statement.subject.eq(getId(s))); } if (p != null) { delete.where(statement.predicate.eq(getId(p))); } if (o != null) { delete.where(statement.object.eq(getId(o))); } if (c != null) { delete.where(statement.model.eq(getId(c))); } delete.execute(); } RDBConnection(RDBContext context); }
RDBConnection implements RDFConnection { @Override public void remove(ID s, UID p, NODE o, UID c) { SQLDeleteClause delete = context.createDelete(statement); if (s != null) { delete.where(statement.subject.eq(getId(s))); } if (p != null) { delete.where(statement.predicate.eq(getId(p))); } if (o != null) { delete.where(statement.object.eq(getId(o))); } if (c != null) { delete.where(statement.model.eq(getId(c))); } delete.execute(); } RDBConnection(RDBContext context); void addLocales(Set<Locale> l, @Nullable BiMap<Locale, Integer> cache); void addNodes(Set<NODE> n, @Nullable BiMap<NODE, Long> cache); @Override RDFBeanTransaction beginTransaction(boolean readOnly, int txTimeout, int isolationLevel); @Override void clear(); @Override void close(); @Override BID createBNode(); @Override Q createUpdate(UpdateLanguage<D, Q> updateLanguage, D definition); @SuppressWarnings("unchecked") @Override Q createQuery(QueryLanguage<D, Q> queryLanguage, D definition); void deleteFromContext(UID model); List<STMT> find(
            @Nullable ID subject,
            @Nullable UID predicate,
            @Nullable NODE object,
            @Nullable UID model, boolean includeInferred); @Override @SuppressWarnings("serial") CloseableIterator<STMT> findStatements(
            @Nullable final ID subject,
            @Nullable final UID predicate,
            @Nullable final NODE object,
            @Nullable final UID model, boolean includeInferred); @Override boolean exists(ID subject, UID predicate, NODE object, UID context, boolean includeInferred); @Override long getNextLocalId(); @Override void remove(ID s, UID p, NODE o, UID c); @Override void update(Collection<STMT> removedStatements, Collection<STMT> addedStatements); @Override QueryOptions getQueryOptions(); @Override InferenceOptions getInferenceOptions(); }
RDBConnection implements RDFConnection { @Override public void remove(ID s, UID p, NODE o, UID c) { SQLDeleteClause delete = context.createDelete(statement); if (s != null) { delete.where(statement.subject.eq(getId(s))); } if (p != null) { delete.where(statement.predicate.eq(getId(p))); } if (o != null) { delete.where(statement.object.eq(getId(o))); } if (c != null) { delete.where(statement.model.eq(getId(c))); } delete.execute(); } RDBConnection(RDBContext context); void addLocales(Set<Locale> l, @Nullable BiMap<Locale, Integer> cache); void addNodes(Set<NODE> n, @Nullable BiMap<NODE, Long> cache); @Override RDFBeanTransaction beginTransaction(boolean readOnly, int txTimeout, int isolationLevel); @Override void clear(); @Override void close(); @Override BID createBNode(); @Override Q createUpdate(UpdateLanguage<D, Q> updateLanguage, D definition); @SuppressWarnings("unchecked") @Override Q createQuery(QueryLanguage<D, Q> queryLanguage, D definition); void deleteFromContext(UID model); List<STMT> find(
            @Nullable ID subject,
            @Nullable UID predicate,
            @Nullable NODE object,
            @Nullable UID model, boolean includeInferred); @Override @SuppressWarnings("serial") CloseableIterator<STMT> findStatements(
            @Nullable final ID subject,
            @Nullable final UID predicate,
            @Nullable final NODE object,
            @Nullable final UID model, boolean includeInferred); @Override boolean exists(ID subject, UID predicate, NODE object, UID context, boolean includeInferred); @Override long getNextLocalId(); @Override void remove(ID s, UID p, NODE o, UID c); @Override void update(Collection<STMT> removedStatements, Collection<STMT> addedStatements); @Override QueryOptions getQueryOptions(); @Override InferenceOptions getInferenceOptions(); static final QSymbol con; static final QSymbol obj; static final QSymbol pre; static final QSymbol sub; }