Search in sources :

Example 71 with PrefixMapping

use of org.apache.jena.shared.PrefixMapping in project jena by apache.

the class TestPrefixMappingTDB method persistent1.

// Persistent.
@Test
public void persistent1() {
    String dir = ConfigTest.getTestingDir();
    FileOps.clearDirectory(dir);
    DatasetPrefixesTDB prefixes = createTesting(Location.create(dir), new DatasetControlMRSW());
    PrefixMapping pmap1 = prefixes.getPrefixMapping();
    String x = pmap1.getNsPrefixURI("x");
    assertNull(x);
    prefixes.close();
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) DatasetControlMRSW(org.apache.jena.tdb.sys.DatasetControlMRSW) DatasetPrefixesTDB(org.apache.jena.tdb.store.DatasetPrefixesTDB) ConfigTest(org.apache.jena.tdb.ConfigTest)

Example 72 with PrefixMapping

use of org.apache.jena.shared.PrefixMapping in project jena by apache.

the class TestPrefixMappingTDB method multiple2.

@Test
public void multiple2() {
    DatasetPrefixesTDB prefixes = createTestingMem();
    // Same
    PrefixMapping pmap1 = prefixes.getPrefixMapping("http://graph/");
    PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/");
    pmap1.setNsPrefix("x", "http://foo/");
    assertNotNull(pmap2.getNsPrefixURI("x"));
    assertNotNull(pmap1.getNsPrefixURI("x"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) DatasetPrefixesTDB(org.apache.jena.tdb.store.DatasetPrefixesTDB) ConfigTest(org.apache.jena.tdb.ConfigTest)

Example 73 with PrefixMapping

use of org.apache.jena.shared.PrefixMapping in project jena by apache.

the class TestPrefixMappingTDB method multiple1.

@Test
public void multiple1() {
    DatasetPrefixesTDB prefixes = createTestingMem();
    PrefixMapping pmap1 = prefixes.getPrefixMapping();
    PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/");
    pmap1.setNsPrefix("x", "http://foo/");
    assertNull(pmap2.getNsPrefixURI("x"));
    assertNotNull(pmap1.getNsPrefixURI("x"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) DatasetPrefixesTDB(org.apache.jena.tdb.store.DatasetPrefixesTDB) ConfigTest(org.apache.jena.tdb.ConfigTest)

Example 74 with PrefixMapping

use of org.apache.jena.shared.PrefixMapping in project jena by apache.

the class AbstractTestPrefixMapping method testRemovePrefix.

public void testRemovePrefix() {
    String hURI = "http://test.remove.prefixes/prefix#";
    String bURI = "http://other.test.remove.prefixes/prefix#";
    PrefixMapping A = getMapping();
    A.setNsPrefix("hr", hURI);
    A.setNsPrefix("br", bURI);
    A.removeNsPrefix("hr");
    assertEquals(null, A.getNsPrefixURI("hr"));
    assertEquals(bURI, A.getNsPrefixURI("br"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 75 with PrefixMapping

use of org.apache.jena.shared.PrefixMapping in project jena by apache.

the class AbstractTestPrefixMapping method testClear.

public void testClear() {
    String hURI = "http://test.remove.prefixes/prefix#";
    String bURI = "http://other.test.remove.prefixes/prefix#";
    PrefixMapping A = getMapping();
    A.setNsPrefix("hr", hURI);
    A.setNsPrefix("br", bURI);
    A.clearNsPrefixMap();
    assertEquals(null, A.getNsPrefixURI("hr"));
    assertEquals(null, A.getNsPrefixURI("br"));
    assertEquals(null, A.getNsURIPrefix(hURI));
    assertEquals(null, A.getNsURIPrefix(bURI));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Aggregations

PrefixMapping (org.apache.jena.shared.PrefixMapping)149 Test (org.junit.Test)47 PrefixMappingImpl (org.apache.jena.shared.impl.PrefixMappingImpl)29 Graph (org.apache.jena.graph.Graph)22 BaseTest (org.apache.jena.atlas.junit.BaseTest)11 Triple (org.apache.jena.graph.Triple)9 Resource (org.apache.jena.rdf.model.Resource)9 Path (org.apache.jena.sparql.path.Path)8 ConfigTest (org.apache.jena.tdb.ConfigTest)8 DatasetPrefixesTDB (org.apache.jena.tdb.store.DatasetPrefixesTDB)8 ContractTest (org.xenei.junit.contract.ContractTest)8 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)7 ArrayList (java.util.ArrayList)5 Node (org.apache.jena.graph.Node)5 Query (org.apache.jena.query.Query)5 Model (org.apache.jena.rdf.model.Model)5 PrefixMappingSDB (org.apache.jena.sdb.graph.PrefixMappingSDB)5 URI (java.net.URI)4 HashMap (java.util.HashMap)4 WhereValidator (org.apache.jena.arq.querybuilder.WhereValidator)4