本文整理了Java中org.apache.jena.rdf.model.Model.containsAll()
方法的一些代码示例,展示了Model.containsAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.containsAll()
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:containsAll
[英]Determine if all of the statements in a model are also contained in this model.
[中]确定模型中的所有语句是否也包含在此模型中。
代码示例来源:origin: vivo-project/Vitro
@Override
public boolean containsAll(StmtIterator iter) {
return inner.containsAll(iter);
}
代码示例来源:origin: vivo-project/Vitro
@Override
public boolean containsAll(Model model) {
return inner.containsAll(model);
}
代码示例来源:origin: apache/jena
public void testIntersection()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model im = model.intersection(model2);
Assert.assertFalse(model.containsAll(model2));
Assert.assertFalse(model2.containsAll(model));
Assert.assertTrue(model.containsAll(im));
Assert.assertTrue(model2.containsAll(im));
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) && model2.contains(s));
}
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
Assert.assertTrue(model.contains(it.nextStatement()));
}
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
Assert.assertTrue(model2.contains(it.nextStatement()));
}
Assert.assertTrue(model.containsAll(im.listStatements()));
Assert.assertTrue(model2.containsAll(im.listStatements()));
}
代码示例来源:origin: apache/jena
public void testUnion()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model um = model.union(model2);
Assert.assertFalse(model.containsAll(model2));
Assert.assertFalse(model2.containsAll(model));
Assert.assertTrue(um.containsAll(model));
Assert.assertTrue(um.containsAll(model2));
for (final StmtIterator it = um.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) || model2.contains(s));
}
for (final StmtIterator it = model.listStatements(); it.hasNext();)
{
Assert.assertTrue(um.contains(it.nextStatement()));
}
for (final StmtIterator it = model2.listStatements(); it.hasNext();)
{
Assert.assertTrue(um.contains(it.nextStatement()));
}
Assert.assertTrue(um.containsAll(model.listStatements()));
Assert.assertTrue(um.containsAll(model2.listStatements()));
}
}
代码示例来源:origin: org.apache.jena/jena-core
public void testIntersection()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model im = model.intersection(model2);
Assert.assertFalse(model.containsAll(model2));
Assert.assertFalse(model2.containsAll(model));
Assert.assertTrue(model.containsAll(im));
Assert.assertTrue(model2.containsAll(im));
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) && model2.contains(s));
}
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
Assert.assertTrue(model.contains(it.nextStatement()));
}
for (final StmtIterator it = im.listStatements(); it.hasNext();)
{
Assert.assertTrue(model2.contains(it.nextStatement()));
}
Assert.assertTrue(model.containsAll(im.listStatements()));
Assert.assertTrue(model2.containsAll(im.listStatements()));
}
代码示例来源:origin: org.apache.jena/jena-core
public void testUnion()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model um = model.union(model2);
Assert.assertFalse(model.containsAll(model2));
Assert.assertFalse(model2.containsAll(model));
Assert.assertTrue(um.containsAll(model));
Assert.assertTrue(um.containsAll(model2));
for (final StmtIterator it = um.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) || model2.contains(s));
}
for (final StmtIterator it = model.listStatements(); it.hasNext();)
{
Assert.assertTrue(um.contains(it.nextStatement()));
}
for (final StmtIterator it = model2.listStatements(); it.hasNext();)
{
Assert.assertTrue(um.contains(it.nextStatement()));
}
Assert.assertTrue(um.containsAll(model.listStatements()));
Assert.assertTrue(um.containsAll(model2.listStatements()));
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testEntityGraphRdf()
throws AnalysisEngineProcessException, ResourceInitializationException, IOException,
URISyntaxException {
processJCas(
RdfEntityGraphConsumer.PARAM_QUERY_ENDPOINT,
"http://localhost:3330/ds/query",
RdfEntityGraphConsumer.PARAM_UPDATE_ENDPOINT,
"http://localhost:3330/ds/update",
RdfEntityGraphConsumer.PARAM_STORE_ENDPOINT,
"http://localhost:3330/ds/data");
Model expected = RDFDataMgr.loadModel(EXPECTED_DOCUMENT_FILE.toURI().toString());
Model model = ds.getDefaultModel();
Resource resource =
expected.getResource(
"http://baleen.dstl.gov.uk/8b408a0c7163fdfff06ced3e80d7d2b3acd9db900905c4783c28295b8c996165");
resource.removeProperties(); // Get rid of the timestamp
StmtIterator listStatements = expected.listStatements();
while (listStatements.hasNext()) {
Statement statement = listStatements.next();
assertTrue("Missing statement " + statement.toString(), model.contains(statement));
}
assertTrue(model.containsAll(expected));
}
代码示例来源:origin: dstl/baleen
@Test
public void testDocumentGraphRdf()
throws AnalysisEngineProcessException, ResourceInitializationException, IOException,
URISyntaxException {
processJCas(
RdfDocumentGraphConsumer.PARAM_QUERY_ENDPOINT,
"http://localhost:" + port + "/ds/query",
RdfDocumentGraphConsumer.PARAM_UPDATE_ENDPOINT,
"http://localhost:" + port + "/ds/update",
RdfDocumentGraphConsumer.PARAM_STORE_ENDPOINT,
"http://localhost:" + port + "/ds/data");
Model expected = RDFDataMgr.loadModel(EXPECTED_DOCUMENT_FILE.toURI().toString());
Model model = ds.getDefaultModel();
Resource resource =
expected.getResource(
"http://baleen.dstl.gov.uk/8b408a0c7163fdfff06ced3e80d7d2b3acd9db900905c4783c28295b8c996165");
resource.removeProperties(); // Get rid of the timestamp
StmtIterator listStatements = expected.listStatements();
while (listStatements.hasNext()) {
Statement statement = listStatements.next();
assertTrue("Missing statement " + statement.toString(), model.contains(statement));
}
assertTrue(model.containsAll(expected));
}
代码示例来源:origin: dstl/baleen
@Test
public void testDocumentGraphRdfithRelationsAsLinks()
throws AnalysisEngineProcessException, ResourceInitializationException, IOException,
URISyntaxException {
processJCas(
RdfDocumentGraphConsumer.PARAM_QUERY_ENDPOINT,
"http://localhost:" + port + "/ds/query",
RdfDocumentGraphConsumer.PARAM_UPDATE_ENDPOINT,
"http://localhost:" + port + "/ds/update",
RdfDocumentGraphConsumer.PARAM_STORE_ENDPOINT,
"http://localhost:" + port + "/ds/data",
RdfDocumentGraphConsumer.PARAM_OUTPUT_RELATIONS_AS_LINKS,
true);
Model expected =
RDFDataMgr.loadModel(EXPECTED_DOCUMENT_RELATION_AS_LINKS_FILE.toURI().toString());
Model model = ds.getDefaultModel();
Resource resource =
expected.getResource(
"http://baleen.dstl.gov.uk/8b408a0c7163fdfff06ced3e80d7d2b3acd9db900905c4783c28295b8c996165");
resource.removeProperties(); // Get rid of the timestamp
StmtIterator listStatements = expected.listStatements();
while (listStatements.hasNext()) {
Statement statement = listStatements.next();
assertTrue("Missing statement " + statement.toString(), model.contains(statement));
}
assertTrue(model.containsAll(expected));
}
代码示例来源:origin: apache/jena
public void testDifference()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model dm = model.difference(model2);
for (final StmtIterator it = dm.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) && !model2.contains(s));
}
for (final StmtIterator it = model.union(model2).listStatements(); it
.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertEquals(model.contains(s) && !model2.contains(s),
dm.contains(s));
}
Assert.assertTrue(dm.containsAny(model));
Assert.assertTrue(dm.containsAny(model.listStatements()));
Assert.assertFalse(dm.containsAny(model2));
Assert.assertFalse(dm.containsAny(model2.listStatements()));
Assert.assertTrue(model.containsAll(dm));
}
代码示例来源:origin: org.apache.jena/jena-core
public void testDifference()
{
ModelHelper.modelAdd(model, "a P b; w R x");
ModelHelper.modelAdd(model2, "w R x; y S z");
final Model dm = model.difference(model2);
for (final StmtIterator it = dm.listStatements(); it.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertTrue(model.contains(s) && !model2.contains(s));
}
for (final StmtIterator it = model.union(model2).listStatements(); it
.hasNext();)
{
final Statement s = it.nextStatement();
Assert.assertEquals(model.contains(s) && !model2.contains(s),
dm.contains(s));
}
Assert.assertTrue(dm.containsAny(model));
Assert.assertTrue(dm.containsAny(model.listStatements()));
Assert.assertFalse(dm.containsAny(model2));
Assert.assertFalse(dm.containsAny(model2.listStatements()));
Assert.assertTrue(model.containsAll(dm));
}
内容来源于网络,如有侵权,请联系作者删除!