本文整理了Java中org.apache.jena.rdf.model.Model.contains()
方法的一些代码示例,展示了Model.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.contains()
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:contains
[英]Determine whether this model contains any statements with a given subject and property.
[中]确定此模型是否包含具有给定主题和属性的任何语句。
代码示例来源:origin: apache/jena
public void testContains( final Model m, final List<Statement> statements )
{
for ( Statement statement : statements )
{
Assert.assertTrue( "it should be here", m.contains( statement ) );
}
}
代码示例来源:origin: apache/jena
public void testAddWithCharObject()
{
model.addLiteral(X, P, 'x');
Assert.assertTrue(model.contains(X, P, model.createTypedLiteral('x')));
Assert.assertTrue(model.containsLiteral(X, P, 'x'));
}
代码示例来源:origin: apache/jena
public void testAddContainsLanguagedString()
{
model.add(S, P, "test string", "en");
Assert.assertFalse(model.contains(S, P, "test string"));
Assert.assertTrue(model.contains(S, P, "test string", "en"));
}
代码示例来源:origin: apache/jena
public void testAddWithDoubleObject()
{
model.addLiteral(X, P, 14.0d);
Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(14.0d)));
Assert.assertTrue(model.containsLiteral(X, P, 14.0d));
}
代码示例来源:origin: apache/jena
/** Checking that the data loaded from someSchemaDorOrgJsonld into a model, is OK */
private void assertJohnDoeIsOK(Model m) {
assertTrue(m.contains(null, RDF.type, m.createResource("http://schema.org/Person")));
assertTrue(m.contains(null, m.createProperty("http://schema.org/name"), "John Doe"));
}
代码示例来源:origin: apache/jena
public void testAddWithFloatObject()
{
model.addLiteral(X, P, 14.0f);
Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(14.0f)));
Assert.assertTrue(model.containsLiteral(X, P, 14.0f));
}
代码示例来源:origin: apache/jena
public void testCreateAnonAlt()
{
final Alt tv = model.createAlt();
Assert.assertTrue(tv.isAnon());
Assert.assertTrue(model.contains(tv, RDF.type, RDF.Alt));
}
代码示例来源:origin: org.apache.jena/jena-core
public void testAddWithLongObject()
{
model.addLiteral(X, P, 99L);
Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(99L)));
Assert.assertTrue(model.containsLiteral(X, P, 99L));
}
代码示例来源:origin: apache/jena
public void testCreateAnonSeq()
{
final Seq tv = model.createSeq();
Assert.assertTrue(tv.isAnon());
Assert.assertTrue(model.contains(tv, RDF.type, RDF.Seq));
}
代码示例来源:origin: apache/jena
private void readIt(Dataset ds) {
Txn.exec(ds, TxnType.READ, ()->{
assertTrue(ds.getDefaultModel().contains(stmt));
});
}
代码示例来源:origin: apache/jena
public void testAddLiteralPassesLiteralUnmodified()
{
final Resource r = model.createResource();
final Literal lit = model.createLiteral("spoo");
r.addLiteral(RDF.value, lit);
Assert.assertTrue("model should contain unmodified literal",
model.contains(null, RDF.value, lit));
}
代码示例来源:origin: apache/jena
public static void assertContainsAll(final Model model, final Model model2) {
for (final StmtIterator s = model2.listStatements(); s.hasNext();) {
Assert.assertTrue(model.contains(s.nextStatement()));
}
}
代码示例来源:origin: org.apache.jena/jena-core
protected void assertContainsAll( final Model model, final Model model2 )
{
for (final StmtIterator s = model2.listStatements(); s.hasNext();)
{
Assert.assertTrue(model.contains(s.nextStatement()));
}
}
代码示例来源:origin: apache/jena
public void testCreateTypedNamedresource()
{
final String uri = "http://aldabaran.hpl.hp.com/foo";
final Resource r = model.createResource(uri, RDF.Property);
Assert.assertEquals(uri, r.getURI());
Assert.assertTrue(model.contains(r, RDF.type, RDF.Property));
}
代码示例来源:origin: apache/jena
protected void assertContainsAll( final Model model, final Model model2 )
{
for (final StmtIterator s = model2.listStatements(); s.hasNext();)
{
Assert.assertTrue(model.contains(s.nextStatement()));
}
}
代码示例来源:origin: apache/jena
public void testGetAlt()
{
final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 160;
model.createAlt(uri);
final Alt a = model.getAlt(uri);
Assert.assertEquals(uri, a.getURI());
Assert.assertTrue(model.contains(a, RDF.type, RDF.Alt));
}
代码示例来源:origin: org.apache.jena/jena-core
public void testGetAlt()
{
final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 160;
model.createAlt(uri);
final Alt a = model.getAlt(uri);
Assert.assertEquals(uri, a.getURI());
Assert.assertTrue(model.contains(a, RDF.type, RDF.Alt));
}
代码示例来源:origin: apache/jena
@Test
public void appRDF() throws Exception {
RDFDataMgr.read(m, load("app.rdf"), Lang.RDFXML);
dumpModelWithMessage("appRDF");
assertTrue("Can't find statement", m.contains(expectedStatement(APP_BASE)));
}
代码示例来源:origin: apache/jena
@Test
public void exampleTTL() throws Exception {
RDFDataMgr.read(m, load("example.ttl"), Lang.TURTLE);
dumpModelWithMessage("exampleTTL");
assertTrue("Can't find statement", m.contains(expectedStatement(EXAMPLE_BASE)));
}
代码示例来源:origin: apache/jena
@Test
public void fileTTL() throws Exception {
RDFDataMgr.read(m, load("file.ttl"), Lang.TURTLE);
dumpModelWithMessage("fileTTL");
assertTrue("Can't find statement", m.contains(expectedStatement(FILE_BASE)));
}
内容来源于网络,如有侵权,请联系作者删除!