Java Code Examples for org.eclipse.rdf4j.model.impl.SimpleValueFactory#createBNode()

The following examples show how to use org.eclipse.rdf4j.model.impl.SimpleValueFactory#createBNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VisulizerTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void datatype() throws Exception {

	ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclDatatype.ttl");

	try (NotifyingSailConnection connection = shaclSail.getConnection()) {
		SimpleValueFactory vf = SimpleValueFactory.getInstance();
		connection.begin();
		BNode bNode = vf.createBNode();
		connection.addStatement(bNode, RDF.TYPE, RDFS.RESOURCE);
		connection.addStatement(bNode, FOAF.AGE, vf.createLiteral(3));
		connection.commit();

		shaclSail.setLogValidationPlans(true);

		connection.begin();
		BNode bNode2 = vf.createBNode();
		connection.addStatement(bNode2, RDF.TYPE, RDFS.RESOURCE);
		connection.removeStatement(null, bNode, FOAF.AGE, vf.createLiteral(3));
		connection.addStatement(vf.createBNode(), FOAF.AGE, vf.createLiteral(""));

		connection.commit();
	}

}
 
Example 2
Source File: VisulizerTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void maxCount() throws Exception {

	ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclMax.ttl");

	try (NotifyingSailConnection connection = shaclSail.getConnection()) {
		SimpleValueFactory vf = SimpleValueFactory.getInstance();
		connection.begin();
		BNode bNode = vf.createBNode();
		connection.addStatement(bNode, RDF.TYPE, RDFS.RESOURCE);
		connection.addStatement(bNode, RDFS.LABEL, vf.createLiteral(""));
		connection.commit();

		shaclSail.setLogValidationPlans(true);

		connection.begin();
		BNode bNode2 = vf.createBNode();
		connection.addStatement(bNode2, RDF.TYPE, RDFS.RESOURCE);
		connection.removeStatement(null, bNode, RDFS.LABEL, vf.createLiteral(""));

		connection.commit();
	}

}
 
Example 3
Source File: VisulizerTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test(expected = SailException.class)
public void minCount() throws Exception {

	ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.ttl");

	try (NotifyingSailConnection connection = shaclSail.getConnection()) {
		SimpleValueFactory vf = SimpleValueFactory.getInstance();
		connection.begin();
		BNode bNode = vf.createBNode();
		connection.addStatement(bNode, RDF.TYPE, RDFS.RESOURCE);
		connection.addStatement(bNode, RDFS.LABEL, vf.createLiteral(""));
		connection.commit();

		shaclSail.setLogValidationPlans(true);

		connection.begin();
		BNode bNode2 = vf.createBNode();
		connection.addStatement(bNode2, RDF.TYPE, RDFS.RESOURCE);
		connection.removeStatement(null, bNode, RDFS.LABEL, vf.createLiteral(""));

		connection.commit();
	}

}