NIHVIVO-3884 adding constant for blank node root finding query

This commit is contained in:
brianjlowe 2012-07-09 14:30:00 +00:00
parent edcf7f708e
commit bb4365cfa8
3 changed files with 5 additions and 4 deletions

View file

@ -27,6 +27,9 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
public abstract class RDFServiceImpl implements RDFService {
private static final Log log = LogFactory.getLog(RDFServiceImpl.class);
protected static final String BNODE_ROOT_QUERY =
"SELECT ?s WHERE { ?s ?p ?o OPTIONAL { ?ss ?pp ?s } FILTER (!isBlank(?s) || !bound(?ss)) }";
protected String defaultWriteGraphURI;
protected List<ChangeListener> registeredListeners = new CopyOnWriteArrayList<ChangeListener>();

View file

@ -93,8 +93,7 @@ public abstract class RDFServiceJena extends RDFServiceImpl implements RDFServic
log.warn("This likely indicates a problem; excessive data may be deleted.");
}
String rootFinder = "SELECT ?s WHERE { ?s ?p ?o OPTIONAL { ?ss ?pp ?s } FILTER (!isBlank(?s) || !bound(?ss)) }";
Query rootFinderQuery = QueryFactory.create(rootFinder);
Query rootFinderQuery = QueryFactory.create(BNODE_ROOT_QUERY);
QueryExecution qe = QueryExecutionFactory.create(rootFinderQuery, blankNodeModel);
try {
ResultSet rs = qe.execSelect();

View file

@ -620,8 +620,7 @@ public class RDFServiceSparql extends RDFServiceImpl implements RDFService {
log.warn("This likely indicates a problem; excessive data may be deleted.");
}
String rootFinder = "SELECT ?s WHERE { ?s ?p ?o OPTIONAL { ?ss ?pp ?s FILTER(!isBlank(?ss)) } FILTER (!bound(?ss)) }";
Query rootFinderQuery = QueryFactory.create(rootFinder);
Query rootFinderQuery = QueryFactory.create(BNODE_ROOT_QUERY);
QueryExecution qe = QueryExecutionFactory.create(rootFinderQuery, blankNodeModel);
try {
ResultSet rs = qe.execSelect();