query = getSPARQLQuery(pidUri);
}
logger.debug(lang + " query: " + query);
TupleIterator tuples;
try {
tuples = RI.findTuples(lang, query,0, false);
if (tuples != null) {
while (tuples.hasNext()) {
Node parent = tuples.next().get("parent");
if (parent != null) {
if (parent.isURIReference()) {
try {
PID parentPID = new PID(parent.stringValue());
logger.debug("Found parent " + parentPID.toString());
parentPIDs.add(parentPID.toString());
} catch (MalformedPIDException e) {
logger.warn("parent/child relationship target is not a Fedora object" + parent.stringValue());
}
} else {
logger.warn("parent/child query result is not a Fedora object " + parent.stringValue());
}
} else {
logger.error("parent/child tuple result did not contain parent variable");
}
}
logger.debug("Query result count: " + tuples.count());
} else {
logger.debug("Query returned 0 results");
}