Search in sources :

Example 56 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractDatasetGraphFindPatterns method find_pattern_s.

@Test
public void find_pattern_s() {
    DatasetGraph dsg = create(dataPattern);
    List<Quad> quads1 = Iter.toList(dsg.find(null, node(":sx"), null, null));
    List<Quad> quads2 = Arrays.asList(q_s, q_gs, q_sp, q_so, q_gsp, q_gso, q_spo, q_gspo);
    BaseTest.assertEqualsUnordered("find(s)", quads1, quads2);
}
Also used : Quad(org.apache.jena.sparql.core.Quad) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 57 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractDatasetGraphFindPatterns method find_pattern_p.

@Test
public void find_pattern_p() {
    DatasetGraph dsg = create(dataPattern);
    List<Quad> quads1 = Iter.toList(dsg.find(null, null, node(":px"), null));
    List<Quad> quads2 = Arrays.asList(q_p, q_gp, q_sp, q_po, q_gsp, q_gpo, q_spo, q_gspo);
    BaseTest.assertEqualsUnordered("find(p)", quads1, quads2);
}
Also used : Quad(org.apache.jena.sparql.core.Quad) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 58 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractDatasetGraphFindPatterns method create.

/**
     * Create the dataset to test loaded with the supplied data - this dataset need not be mutable.
     * Either supply {@link #create()} or override this method.  
     */
protected DatasetGraph create(Collection<Quad> data) {
    DatasetGraph dsg = create();
    add(dsg, data);
    return dsg;
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph)

Example 59 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractDatasetGraphFindPatterns method find_quad_00.

@Test
public void find_quad_00() {
    DatasetGraph dsg = create(dataPattern);
    List<Quad> quads1 = Iter.toList(dsg.find());
    assertNotNull("find()", quads1);
    List<Quad> quads2 = toList(dsg.find(null, null, null, null));
    assertNotNull("find(null,null,null,null)", quads2);
    BaseTest.assertEqualsUnordered("find()", quads1, quads2);
}
Also used : Quad(org.apache.jena.sparql.core.Quad) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 60 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractDatasetGraphFindPatterns method find_pattern_go.

@Test
public void find_pattern_go() {
    DatasetGraph dsg = create(dataPattern);
    List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, null, node(":ox")));
    List<Quad> quads2 = Arrays.asList(q_go, q_gpo, q_gso, q_gspo);
    BaseTest.assertEqualsUnordered("find(go)", quads1, quads2);
}
Also used : Quad(org.apache.jena.sparql.core.Quad) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)222 Test (org.junit.Test)132 BaseTest (org.apache.jena.atlas.junit.BaseTest)59 Quad (org.apache.jena.sparql.core.Quad)47 Node (org.apache.jena.graph.Node)29 Graph (org.apache.jena.graph.Graph)18 StoreConnection (org.apache.jena.tdb.StoreConnection)17 DatasetGraphTxn (org.apache.jena.tdb.transaction.DatasetGraphTxn)15 Model (org.apache.jena.rdf.model.Model)10 IOException (java.io.IOException)7 Triple (org.apache.jena.graph.Triple)7 Dataset (org.apache.jena.query.Dataset)7 StreamRDF (org.apache.jena.riot.system.StreamRDF)7 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)5 ResultSet (org.apache.jena.query.ResultSet)5 JsonLDWriteContext (org.apache.jena.riot.JsonLDWriteContext)5 Element (org.apache.jena.sparql.syntax.Element)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 RiotException (org.apache.jena.riot.RiotException)4 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)4