org.apache.commons.rdf.api.Dataset.remove()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.apache.commons.rdf.api.Dataset.remove()方法的一些代码示例,展示了Dataset.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dataset.remove()方法的具体详情如下:
包路径:org.apache.commons.rdf.api.Dataset
类名称:Dataset
方法名:remove

Dataset.remove介绍

暂无

代码示例

代码示例来源:origin: org.apache.commons/commons-rdf-simple

@Override
public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) {
  dataset.remove(unionOrNamedGraph(), subject, predicate, object);
}

代码示例来源:origin: org.apache.commons/commons-rdf-simple

@Override
public void clear() {
  dataset.remove(unionOrNamedGraph(), null, null, null);
}

代码示例来源:origin: org.trellisldp/trellis-rosid-common

dataset.remove(of(PreferServerManaged), null, type, null);
  dataset.add(PreferServerManaged, identifier, type, ixnModel);
  dataset.add(PreferUserManaged, identifier, type, DeletedResource);
} else {
  dataset.remove(of(PreferUserManaged), identifier, type, DeletedResource);

代码示例来源:origin: org.apache.commons/commons-rdf-simple

@Override
public void remove(final Triple triple) {
  dataset.remove(unionOrNamedGraph(), triple.getSubject(), triple.getPredicate(), triple.getObject());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test(expected = IllegalStateException.class)
public void remove() throws Exception {
  dataset.remove(new DummyQuad());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void removeSPO() throws Exception {
  dataset.remove(null, new DummyIRI(0), new DummyIRI(0), new DummyIRI(0));
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void remove() throws Exception {
  final long fullSize = dataset.size();
  dataset.remove(Optional.of(graph1), alice, knows, bob);
  final long shrunkSize = dataset.size();
  assertEquals(1, fullSize - shrunkSize);
  dataset.remove(Optional.of(graph1), alice, knows, bob);
  dataset.remove(null, alice, knows, bob);
  assertEquals(shrunkSize, dataset.size());
  dataset.remove(otherQuad);
  assertEquals(shrunkSize - 1, dataset.size());
  dataset.remove(otherQuad);
  assertEquals(shrunkSize - 1, dataset.size()); // no change

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void removeLanguageTagsCaseInsensitive() {
  // COMMONSRDF-51: Ensure we can remove with any casing
  // of literal language tag
  final Literal lower = factory.createLiteral("Howdy", "en-us");
  final Literal upper = factory.createLiteral("Howdy", "EN-US");
  final Literal mixed = factory.createLiteral("Howdy", "en-US");
  final IRI example1 = factory.createIRI("http://example.com/s1");
  final IRI greeting = factory.createIRI("http://example.com/greeting");
  dataset.add(null, example1, greeting, upper);
  // Remove should also honour any case
  dataset.remove(null, example1, null, mixed);
  assertFalse(dataset.contains(null, null, greeting, null));
  dataset.add(null, example1, greeting, lower);
  dataset.remove(null, example1, null, upper);
  // Check with Triple
  dataset.add(factory.createQuad(null, example1, greeting, mixed));
  dataset.remove(factory.createQuad(null, example1, greeting, upper));
  assertFalse(dataset.contains(null, null, greeting, null));
}

代码示例来源:origin: trellis-ldp/trellis

@Test
public void testAppendSemantics() {
  final Quad testFirstQuad = createQuad(testResourceId3, testResourceId2, testResourceId1, badId);
  final Quad testSecondQuad = createQuad(testResourceId3, testResourceId2, testResourceId1, badId);
  // store some data in mutable and immutable sides under the same resource ID
  final Resource testFirstResource = new TestResource(testResourceId3, testFirstQuad);
  assertNull(testable.add(testResourceId3, testFirstResource.dataset()).toCompletableFuture().join(),
          "Couldn't create an immutable resource!");
  final Resource testSecondResource = new TestResource(testResourceId3, testSecondQuad);
  assertNull(testable.add(testResourceId3, testSecondResource.dataset()).toCompletableFuture().join(),
          "Couldn't add to an immutable resource!");
  final Resource retrieved = testable.get(testResourceId3).toCompletableFuture().join();
  assertEquals(testResourceId3, retrieved.getIdentifier(), "Resource was retrieved with wrong ID!");
  final Dataset quads = retrieved.dataset();
  assertTrue(quads.contains(testFirstQuad), "Resource was retrieved without its immutable data!");
  assertTrue(quads.contains(testSecondQuad), "Resource was retrieved without its mutable data!");
  quads.remove(testFirstQuad);
  quads.remove(testSecondQuad);
  assertEquals(0, quads.size(), "Resource was retrieved with too much data!");
}

代码示例来源:origin: trellis-ldp/trellis

@Test
public void testMergingBehavior() {
  final Quad testMutableQuad = createQuad(testResourceId2, testResourceId2, testResourceId1, badId);
  final Quad testImmutableQuad = createQuad(testResourceId2, testResourceId2, testResourceId1, badId);
  // store some data in mutable and immutable sides under the same resource ID
  final Resource testMutableResource = new TestResource(testResourceId2, testMutableQuad);
  assertNull(testable.create(Metadata.builder(testMutableResource).build(), testMutableResource.dataset())
      .toCompletableFuture().join(), "Couldn't create a resource!");
  final Resource testImmutableResource = new TestResource(testResourceId2, testImmutableQuad);
  assertNull(testable.add(testResourceId2, testImmutableResource.dataset()).toCompletableFuture().join(),
          "Couldn't create an immutable resource!");
  final Resource retrieved = testable.get(testResourceId2).toCompletableFuture().join();
  assertEquals(testMutableResource.getIdentifier(), retrieved.getIdentifier(),
          "Resource was retrieved with wrong ID!");
  final Dataset quads = retrieved.dataset();
  assertTrue(quads.contains(testImmutableQuad), "Resource was retrieved without its immutable data!");
  assertTrue(quads.contains(testMutableQuad), "Resource was retrieved without its mutable data!");
  quads.remove(testImmutableQuad);
  quads.remove(testMutableQuad);
  assertEquals(0, quads.size(), "Resource was retrieved with too much data!");
}

相关文章