Search in sources :

Example 41 with Model

use of org.apache.jena.rdf.model.Model in project jena by apache.

the class TestDatasetAccessorHTTP method put_03.

@Test
public void put_03() {
    DatasetAccessor du = connectToService();
    du.putModel(model1);
    // PUT overwrites
    du.putModel(model2);
    Model graph = du.getModel();
    assertFalse(graph.isIsomorphicWith(model1));
    assertTrue(graph.isIsomorphicWith(model2));
    // Empty it.
    du.deleteDefault();
    graph = du.getModel();
    assertTrue(graph.isEmpty());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Example 42 with Model

use of org.apache.jena.rdf.model.Model in project jena by apache.

the class TestDatasetAccessorHTTP method post_02.

@Test
public void post_02() {
    DatasetAccessor du = connectToService();
    du.add(model1);
    du.add(model2);
    Model graph = du.getModel();
    Model graph3 = ModelFactory.createDefaultModel();
    graph3.add(model1);
    graph3.add(model2);
    assertFalse(graph.isIsomorphicWith(model1));
    assertFalse(graph.isIsomorphicWith(model2));
    assertTrue(graph.isIsomorphicWith(graph3));
    // Empty it.
    du.deleteDefault();
    graph = du.getModel();
    assertTrue(graph.isEmpty());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Example 43 with Model

use of org.apache.jena.rdf.model.Model in project jena by apache.

the class TestDatasetAccessorHTTP method put_02.

@Test
public void put_02() {
    DatasetAccessor du = connectToService();
    du.putModel(gn1, model1);
    boolean exists = du.containsModel(gn1);
    assertTrue(exists);
    exists = du.containsModel(gn2);
    assertFalse("Expected gn2 not to exist", exists);
    Model graph = du.getModel();
    assertTrue(graph.isEmpty());
    graph = du.getModel(gn1);
    assertTrue(graph.isIsomorphicWith(model1));
    du.deleteModel(gn1);
    exists = du.containsModel(gn1);
    assertFalse("Expected gn1 not to exist", exists);
    graph = du.getModel(gn1);
    assertNull(graph);
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Example 44 with Model

use of org.apache.jena.rdf.model.Model in project jena by apache.

the class TestDatasetAccessorHTTP method get_04.

@Test
public void get_04() {
    DatasetAccessor du = connectToDataset();
    Model graph = du.getModel(gn1);
    assertNull(graph);
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Example 45 with Model

use of org.apache.jena.rdf.model.Model in project jena by apache.

the class TestDatasetAccessorHTTP method test_404_3.

@Test
public void test_404_3() {
    // Right service, wrong graph
    DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceGSP());
    Model graph = du.getModel(gn99);
    assertNull(graph);
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Aggregations

Model (org.apache.jena.rdf.model.Model)920 Test (org.junit.Test)338 Dataset (org.apache.jena.query.Dataset)196 Resource (org.apache.jena.rdf.model.Resource)178 StringReader (java.io.StringReader)66 Statement (org.apache.jena.rdf.model.Statement)54 Property (org.apache.jena.rdf.model.Property)45 InfModel (org.apache.jena.rdf.model.InfModel)41 Ignore (org.junit.Ignore)38 RDFNode (org.apache.jena.rdf.model.RDFNode)35 Node (org.apache.jena.graph.Node)34 URI (java.net.URI)33 Graph (org.apache.jena.graph.Graph)33 QueryExecution (org.apache.jena.query.QueryExecution)31 Reader (java.io.Reader)30 StmtIterator (org.apache.jena.rdf.model.StmtIterator)27 RDFReaderI (org.apache.jena.rdf.model.RDFReaderI)25 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)24 RdfUtils (won.protocol.util.RdfUtils)24 InputStream (java.io.InputStream)22