Search in sources :

Example 41 with PrefixMapping

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

the class OpPrefixesUsed method used.

public static PrefixMapping used(Op op, PrefixMapping pmap) {
    PrefixMapping pmap2 = new PrefixMappingImpl();
    PrefixFinder finder = new PrefixFinder(pmap2, pmap.getNsPrefixMap());
    OpWalker.walk(op, finder);
    return pmap2;
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Example 42 with PrefixMapping

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

the class BuilderPrefixMapping method build.

public static PrefixMapping build(Item elt) {
    PrefixMapping pmap = new PrefixMappingImpl();
    build(pmap, elt);
    return pmap;
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) PrefixMappingImpl(org.apache.jena.shared.impl.PrefixMappingImpl)

Example 43 with PrefixMapping

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

the class AbstractTestPrefixMappingView method prefix3.

@Test
public void prefix3() {
    String uri = "http://example/";
    PrefixMapping pmap = create();
    pmap.setNsPrefix("ex", uri);
    // Create a second view onto the same storage.
    PrefixMapping pmap2 = view();
    String x = pmap2.getNsPrefixURI("ex");
    assertNotNull(x);
    assertEquals(uri, x);
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) Test(org.junit.Test)

Example 44 with PrefixMapping

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

the class AbstractTestPrefixMappingView method prefix5.

@Test
public void prefix5() {
    String uri = "http://example/";
    PrefixMapping pmap = create();
    pmap.setNsPrefix("ex", uri);
    assertEquals(uri + "foo", pmap.expandPrefix("ex:foo"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) Test(org.junit.Test)

Example 45 with PrefixMapping

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

the class AbstractTestPrefixMappingView method prefix6.

@Test
public void prefix6() {
    String uri = "http://example/";
    PrefixMapping pmap = create();
    pmap.setNsPrefix("ex", uri);
    assertEquals("ex:foo", pmap.qnameFor("http://example/foo"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) Test(org.junit.Test)

Aggregations

PrefixMapping (org.apache.jena.shared.PrefixMapping)154 Test (org.junit.Test)47 PrefixMappingImpl (org.apache.jena.shared.impl.PrefixMappingImpl)34 Graph (org.apache.jena.graph.Graph)22 Path (org.apache.jena.sparql.path.Path)12 BaseTest (org.apache.jena.atlas.junit.BaseTest)11 Triple (org.apache.jena.graph.Triple)9 Resource (org.apache.jena.rdf.model.Resource)9 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 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 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 WhereValidator (org.apache.jena.arq.querybuilder.WhereValidator)4 Dataset (org.apache.jena.query.Dataset)4