Package org.openrdf.sail

Examples of org.openrdf.sail.SailConnection.addStatement()


            try {
                sc.begin();
                ValueFactory vf = sail.getValueFactory();
                sc.addStatement(vf.createURI("http://tinkerpop.com#1"), vf.createURI("http://tinkerpop.com#knows"), vf.createURI("http://tinkerpop.com#3"), vf.createURI("http://tinkerpop.com"));
                sc.addStatement(vf.createURI("http://tinkerpop.com#1"), vf.createURI("http://tinkerpop.com#name"), vf.createLiteral("marko"), vf.createURI("http://tinkerpop.com"));
                sc.addStatement(vf.createURI("http://tinkerpop.com#3"), vf.createURI("http://tinkerpop.com#name"), vf.createLiteral("josh"), vf.createURI("http://tinkerpop.com"));
                CloseableIteration<? extends Statement, SailException> results = sc.getStatements(null, null, null, false);
                try {
                    System.out.println("get statements: ?s ?p ?o ?g");
                    while (results.hasNext()) {
                        System.out.println(results.next());
View Full Code Here


    ValueFactory factory = store.getValueFactory();
    URI foo = factory.createURI("http://www.foo.example/foo");
    URI bar = factory.createURI("http://www.foo.example/bar");

    SailConnection con = store.getConnection();
    con.addStatement(foo, RDF.TYPE, bar);
    con.commit();

    ParsedTupleQuery query = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT X, P, Y FROM {X} P {Y}", null);
    TupleExpr tupleExpr = query.getTupleExpr();
View Full Code Here

                try {
                    con.begin();

                    con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
                    for(Statement stmt : entry.getTriples()) {
                        con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), store.getValueFactory().createURI(cacheContext));
                    }

                    con.commit();

                    entry.setResource(store.getValueFactory().createURI(resource.stringValue()));
View Full Code Here

            for(Statement stmt : version.getAddedTriples()) {
                con.removeStatements(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), stmt.getContext());
            }

            for(Statement stmt : version.getRemovedTriples()) {
                con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), stmt.getContext());
            }

            con.commit();
        } finally {
            con.close();
View Full Code Here

            for(Statement stmt : version.getAddedTriples()) {
                con.removeStatements(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), stmt.getContext());
            }

            for(Statement stmt : version.getRemovedTriples()) {
                con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), stmt.getContext());
            }

            con.commit();
        } finally {
            con.close();
View Full Code Here

    @Test
    public void testAddStatement() throws SailException {
        final SailConnection con = cas.getConnection();
        try {
            con.begin();
            con.addStatement(u1, p2, l3);
            con.commit();
        } catch (final Throwable t) {
            con.rollback();
            throw t;
        } finally {
View Full Code Here

       
        final SailConnection con = sail.getConnection();
        try {
            con.begin();
           
            con.addStatement(u1, p1, l1, c1);
            con.addStatement(u2, p2, l2, c2);
            con.addStatement(u3, p3, l3, c1);
            con.addStatement(u4, p4, l4, c2);
           
            con.commit();
View Full Code Here

        final SailConnection con = sail.getConnection();
        try {
            con.begin();
           
            con.addStatement(u1, p1, l1, c1);
            con.addStatement(u2, p2, l2, c2);
            con.addStatement(u3, p3, l3, c1);
            con.addStatement(u4, p4, l4, c2);
           
            con.commit();
        } catch (final Throwable t) {
View Full Code Here

        try {
            con.begin();
           
            con.addStatement(u1, p1, l1, c1);
            con.addStatement(u2, p2, l2, c2);
            con.addStatement(u3, p3, l3, c1);
            con.addStatement(u4, p4, l4, c2);
           
            con.commit();
        } catch (final Throwable t) {
            con.rollback();
View Full Code Here

            con.begin();
           
            con.addStatement(u1, p1, l1, c1);
            con.addStatement(u2, p2, l2, c2);
            con.addStatement(u3, p3, l3, c1);
            con.addStatement(u4, p4, l4, c2);
           
            con.commit();
        } catch (final Throwable t) {
            con.rollback();
            throw t;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.