public static void main(String[] args) throws Exception {
/// turn off the "No BGP optimizer warning"
TDB.setOptimizerWarningFlag(false);
final IRIFactory iriFactory = IRIFactory.semanticWebImplementation();
final String DATASET_DIR_NAME = "data0";
final Dataset data0 = TDBFactory.createDataset( DATASET_DIR_NAME );
// show the currently registered names
for (Iterator<String> it = data0.listNames(); it.hasNext(); ) {
out.println("NAME="+it.next());
}
out.println("getting named model...");
/// this is the OWL portion
final Model model = data0.getNamedModel( MY_NS );
out.println("Model := "+model);
out.println("getting graph...");
/// this is the DATA in that MODEL
final Graph graph = model.getGraph();
out.println("Graph := "+graph);
if (graph.isEmpty()) {
final Resource product1 = model.createResource(
iriFactory.construct( MY_NS +"product/1" )
.toString() );
final Property hasName = model.createProperty( MY_NS, "#hasName");
final Statement stmt = model.createStatement(
product1, hasName, model.createLiteral("Beach Ball","en") );