if (aURI != null) {
aNG = aURI.toString();
}
}
Dialect aDialect = theSource.getQueryFactory().getDialect();
Resource aResource = EmpireUtil.asResource(EmpireUtil.asSupportsRdfId(theObj));
// bnode instabilty in queries will just yield either a parse error or incorrect query results because the bnode
// will get treated as a variable, and it will just grab the entire database, which is not what we want
if (aResource instanceof BNode && !(aDialect instanceof ARQSPARQLDialect)) {
return Graphs.newGraph();
}
// TODO: if source supports describe queries, use that.
String aSPARQL = "construct {?s ?p ?o}\n" +
(aNG == null ? "" : "from <" + aNG + ">\n") +
"where {?s ?p ?o. filter(?s = " + aDialect.asQueryString(aResource) + ") }";
String aSeRQL = "construct {s} p {o}\n" +
(aNG == null ? "from\n" : "from context <" + aNG + ">\n") +
"{s} p {o} where s = " + aDialect.asQueryString(aResource) + "";
Graph aGraph;
if (theSource.getQueryFactory().getDialect() instanceof SerqlDialect) {
aGraph = theSource.graphQuery(aSeRQL);