Search in sources :

Example 1 with PrefixEntry

use of org.apache.jena.riot.system.PrefixEntry in project jena by apache.

the class StoragePrefixesSimpleMem method get.

@Override
public Iterator<PrefixEntry> get(Node graphNode) {
    graphNode = canonicalGraphName(graphNode);
    PrefixMap pmap = map.get(graphNode);
    if (pmap == null)
        return Iter.nullIterator();
    return pmap.getMapping().entrySet().stream().map(e -> PrefixEntry.create(e.getKey(), e.getValue())).iterator();
}
Also used : PrefixEntry(org.apache.jena.riot.system.PrefixEntry) PrefixMap(org.apache.jena.riot.system.PrefixMap) PrefixMapZero(org.apache.jena.riot.system.PrefixMapZero) Iterator(java.util.Iterator) Node(org.apache.jena.graph.Node) Map(java.util.Map) StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) PrefixLib.canonicalGraphName(org.apache.jena.riot.system.PrefixLib.canonicalGraphName) HashMap(java.util.HashMap) Iter(org.apache.jena.atlas.iterator.Iter) PrefixMapFactory(org.apache.jena.riot.system.PrefixMapFactory) PrefixMap(org.apache.jena.riot.system.PrefixMap)

Example 2 with PrefixEntry

use of org.apache.jena.riot.system.PrefixEntry in project jena by apache.

the class AbstractTestDatasetPrefixesStorage method dsg_prefixes_11.

// Accessors
@Test
public void dsg_prefixes_11() {
    StoragePrefixes prefixes = create();
    prefixes.add(g1, pref1, "http://example.net/ns#");
    List<Node> x = Iter.toList(prefixes.listGraphNodes());
    assertEquals(1, x.size());
    List<PrefixEntry> y = Iter.toList(prefixes.get(g1));
    assertEquals(1, y.size());
}
Also used : StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) Node(org.apache.jena.graph.Node) PrefixEntry(org.apache.jena.riot.system.PrefixEntry) Test(org.junit.Test)

Aggregations

StoragePrefixes (org.apache.jena.dboe.storage.StoragePrefixes)2 Node (org.apache.jena.graph.Node)2 PrefixEntry (org.apache.jena.riot.system.PrefixEntry)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Iter (org.apache.jena.atlas.iterator.Iter)1 PrefixLib.canonicalGraphName (org.apache.jena.riot.system.PrefixLib.canonicalGraphName)1 PrefixMap (org.apache.jena.riot.system.PrefixMap)1 PrefixMapFactory (org.apache.jena.riot.system.PrefixMapFactory)1 PrefixMapZero (org.apache.jena.riot.system.PrefixMapZero)1 Test (org.junit.Test)1