Utililty code related to rdf4j.
The ModelBuilderFacade
is a (partial) facade over the rdf4j ModelBuilder.
It includes some convenience methods for adding collections and for skipping over nullable values.
Usage example:
Namespace nsData = new SimpleNamespace("", "http://data.example.org/");
ModelBuilderFacade mbf = new ModelBuilderFacade(nsData);
// shaka is likely, but not guaranteed
String shaka = Math.random() >= 0.1 ? "hang loose" : null;
mbf.subject(":Hawaii")
.addEach("rdfs:label", Arrays.asList("Hawaiʻi", "Big Island"))
.addNullable("rdfs:comment", shaka);
For more examples, have a look at the unit tests.