use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class ThriftRDF method protocolToStream.
/**
* Decode the contents of the TProtocol and send to the {@link StreamRDF}.
* @param protocol TProtocol
* @param dest Sink
*/
public static void protocolToStream(TProtocol protocol, StreamRDF dest) {
PrefixMap pmap = PrefixMapFactory.create();
final Thrift2StreamRDF s = new Thrift2StreamRDF(pmap, dest);
dest.start();
apply(protocol, z -> TRDF.visit(z, s));
// Includes flushing the protocol.
dest.finish();
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class QueryExecDataset method insertPrefixesInto.
private void insertPrefixesInto(DatasetGraph dsg) {
try {
PrefixMap pmap = dsg.prefixes();
if (dataset != null) {
// Load the models prefixes first
pmap.putAll(dataset.prefixes());
}
// Then add the queries (just the declared mappings)
// so the query declarations override the data sources.
query.getPrefixMapping().getNsPrefixMap().forEach((prefix, uri) -> pmap.add(prefix, uri));
} catch (Exception ex) {
Log.warn(this, "Exception in insertPrefixes: " + ex.getMessage(), ex);
}
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class QueryExecDataset method insertPrefixesInto.
private void insertPrefixesInto(Graph graph) {
try {
if (dataset != null) {
// Load the models prefixes first
PrefixMap m = dataset.prefixes();
m.forEach((prefix, uri) -> graph.getPrefixMapping().setNsPrefix(prefix, uri));
}
// Then add the queries (just the declared mappings)
// so the query declarations override the data sources.
graph.getPrefixMapping().setNsPrefixes(query.getPrefixMapping());
} catch (Exception ex) {
Log.warn(this, "Exception in insertPrefixes: " + ex.getMessage(), ex);
}
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class TestPrefixMappingOverDatasetPrefixes method view.
@Override
protected PrefixMapping view() {
StoragePrefixMap view = StoragePrefixesView.internal_viewDefaultGraph(dsgprefixes);
PrefixMap pmap = PrefixesDboeFactory.newPrefixMap(view);
return Prefixes.adapt(pmap);
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class TestPrefixLib method abbreviate_1.
@Test
public void abbreviate_1() {
PrefixMap prefixes = create();
prefixes.add(pref1, "http://example.net/ns#");
String x = PrefixLib.abbreviate(prefixes, "http://example.net/ns#xyz");
assertEquals("pref1:xyz", x);
}
Aggregations