Search in sources :

Example 81 with PrefixMapping

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

the class AbstractTestPrefixMapping method testExpandPrefix.

public void testExpandPrefix() {
    PrefixMapping ns = getMapping();
    ns.setNsPrefix("crisp", crispURI);
    ns.setNsPrefix("rope", ropeURI);
    /* */
    for (String aDontChange : dontChange) {
        assertEquals("should be unchanged", aDontChange, ns.expandPrefix(aDontChange));
    }
    /* */
    for (String[] expansion : expansions) {
        assertEquals("should expand correctly", expansion[1], ns.expandPrefix(expansion[0]));
    }
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 82 with PrefixMapping

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

the class AbstractTestPrefixMapping method testSameURIKeepsDefault.

/**
        Test that adding a new prefix mapping for U does not throw away a default 
        mapping for U.
    */
public void testSameURIKeepsDefault() {
    PrefixMapping A = getMapping();
    A.setNsPrefix("", crispURI);
    A.setNsPrefix("crisp", crispURI);
    assertEquals(crispURI, A.getNsPrefixURI(""));
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 83 with PrefixMapping

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

the class FusekiLib method addDataInto.

// Do the addition directly on the dataset
public static void addDataInto(Graph data, DatasetGraph dsg, Node graphName) {
    // Prefixes?
    if (graphName == null)
        graphName = Quad.defaultGraphNodeGenerated;
    Iterator<Triple> iter = data.find(Node.ANY, Node.ANY, Node.ANY);
    for (; iter.hasNext(); ) {
        Triple t = iter.next();
        dsg.add(graphName, t.getSubject(), t.getPredicate(), t.getObject());
    }
    PrefixMapping pmapSrc = data.getPrefixMapping();
    PrefixMapping pmapDest = dsg.getDefaultGraph().getPrefixMapping();
    pmapDest.setNsPrefixes(pmapSrc);
}
Also used : Triple(org.apache.jena.graph.Triple) PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 84 with PrefixMapping

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

the class AbstractTestGraphOverDataset method graphDSG_prefixes_3.

@Test
public void graphDSG_prefixes_3() {
    Graph g = makeDefaultGraph(baseDSG);
    PrefixMapping pmap = g.getPrefixMapping();
    assertNotNull(pmap);
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Graph(org.apache.jena.graph.Graph) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 85 with PrefixMapping

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

the class AbstractTestGraphOverDataset method graphDSG_prefixes_2.

@Test
public void graphDSG_prefixes_2() {
    Graph g = makeNamedGraph(baseDSG, Quad.unionGraph);
    PrefixMapping pmap = g.getPrefixMapping();
    assertNotNull(pmap);
}
Also used : PrefixMapping(org.apache.jena.shared.PrefixMapping) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Graph(org.apache.jena.graph.Graph) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

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