Пример #1
0
  public static Graph getGraph() {

    Graph g = Factory.createGraphMem();

    g.add(
        new Triple(
            NodeFactory.createURI("http://example.com/subject"),
            NodeFactory.createURI("http://example.com/predicate"),
            NodeFactory.createURI("http://example.com/object")));

    g.add(
        new Triple(
            NodeFactory.createBlankNode(BlankNodeId.create("a")),
            NodeFactory.createURI("http://example.com/p1"),
            NodeFactory.createBlankNode(BlankNodeId.create("b"))));

    g.add(
        new Triple(
            NodeFactory.createBlankNode(BlankNodeId.create("b")),
            NodeFactory.createURI("http://example.com/p2"),
            NodeFactory.createLiteral("foo")));

    g.add(
        new Triple(
            NodeFactory.createURI("http://example.com/ns/e"),
            NodeFactory.createURI("http://example.com/ns/p5"),
            NodeFactory.createLiteral("verify base works")));

    return g;
  }