use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class QueryExecutionBase method insertPrefixesInto.
private void insertPrefixesInto(Model model) {
try {
if (dataset != null) {
// Load the models prefixes first
PrefixMapping m = dataset.getDefaultModel();
model.setNsPrefixes(m);
}
// Then add the queries (just the declared mappings)
// so the query declarations override the data sources.
model.setNsPrefixes(query.getPrefixMapping());
} catch (Exception ex) {
Log.warn(this, "Exception in insertPrefixes: " + ex.getMessage(), ex);
}
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class MgtFunctions method prefixes.
/** Return prefixes for the datasets, SPARQL syntax. */
public static String prefixes(HttpServletRequest request) {
String dsName = dataset(request);
DatasetRef desc = getFromRegistry(dsName);
if (desc == null)
return "<not found>";
DatasetGraph dsg = desc.dataset;
if (dsg instanceof DatasetGraphTDB) {
PrefixMapping pmap = ((DatasetGraphTDB) dsg).getPrefixes().getPrefixMapping();
Prologue prologue = new Prologue(pmap);
IndentedLineBuffer buff = new IndentedLineBuffer();
PrologueSerializer.output(buff, prologue);
buff.append("\n");
return buff.asString();
}
return "";
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class DatasetPrefixStorageLogger method getPrefixMapping.
@Override
public PrefixMapping getPrefixMapping() {
PrefixMapping x = other.getPrefixMapping();
info("getPrefixMapping() -> " + x);
return x;
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class DatasetPrefixStorageLogger method getPrefixMapping.
@Override
public PrefixMapping getPrefixMapping(String graphName) {
PrefixMapping x = other.getPrefixMapping(graphName);
info("getPrefixMapping(" + graphName + ") -> " + x);
return x;
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestPrefixMappingSDB method prefix5.
@Test
public void prefix5() {
String uri = "http://example/";
PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb);
pmap.setNsPrefix("ex", uri);
assertEquals(uri + "foo", pmap.expandPrefix("ex:foo"));
}
Aggregations