Search in sources :

Example 6 with PrefixMapping

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

the class AbstractTestPrefixMapping method testNumPrefixes.

public void testNumPrefixes() {
    String hURI = "http://test.prefixes/prefix#";
    PrefixMapping A = getMapping();
    assertEquals(0, A.numPrefixes());
    A.setNsPrefix("hr", hURI);
    assertEquals(1, A.numPrefixes());
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 7 with PrefixMapping

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

the class AbstractTestPrefixMapping method getCrispyRope.

private PrefixMapping getCrispyRope() {
    PrefixMapping ns = getMapping();
    ns.setNsPrefix("crisp", crispURI);
    ns.setNsPrefix("rope", ropeURI);
    return ns;
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 8 with PrefixMapping

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

the class AbstractTestPrefixMapping method testNoQNameNoPrefix.

public void testNoQNameNoPrefix() {
    PrefixMapping ns = getMapping();
    String alphaURI = "http://seasonal.song/preamble/";
    ns.setNsPrefix("alpha", alphaURI);
    assertEquals(null, ns.qnameFor("eg:rowboat"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 9 with PrefixMapping

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

the class AbstractTestPrefixMapping method testAddMap.

/**
        as for testAddOtherPrefixMapping, except that it's a plain Map
        we're adding.
    */
public void testAddMap() {
    PrefixMapping b = getMapping();
    Map<String, String> map = new HashMap<>();
    map.put("crisp", crispURI);
    map.put("rope", ropeURI);
    b.setNsPrefix("butter", butterURI);
    b.setNsPrefixes(map);
    checkContainsMapping(b);
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) HashMap(java.util.HashMap)

Example 10 with PrefixMapping

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

the class AbstractTestPrefixMapping method testSecondPrefixRetainsExistingMap.

public void testSecondPrefixRetainsExistingMap() {
    PrefixMapping A = getMapping();
    A.setNsPrefix("a", crispURI);
    A.setNsPrefix("b", crispURI);
    assertEquals(crispURI, A.getNsPrefixURI("a"));
    assertEquals(crispURI, A.getNsPrefixURI("b"));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

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