try {
logger.debug("Getting attribute using relationship " + relationship);
relationships = m_relationshipResolver.getRelationships(queryTarget, relationship);
} catch (MelcoeXacmlException e) {
throw new AttributeFinderException(e.getMessage(), e);
}
if (relationships == null || relationships.isEmpty()) {
return new EvaluationResult(BagAttribute.createEmptyBag(type));
}
// there will only be results for one attribute, this will get all the values
results = relationships.get(relationship);
} else {
// get the language and query output variable
String queryLang = attribute.get("queryLang"); // language
String variable = attribute.get("value"); // query text
String resource = attribute.get("resource"); // resource marker in query
String object = attribute.get("object"); // object/pid marker in query
String subjectURI = "info:fedora/" + subject;
String pidURI = "info:fedora/" + pid;
// replace the resource marker in the query with the subject
if (resource != null) {
query = query.replace(resource, subjectURI);
}
// and the pid/object marker
if (object != null) {
query = query.replace(object, pidURI);
}
// run it
try {
logger.debug("Using a " + queryLang + " query to get attribute " + attribute);
results = m_relationshipResolver.getAttributesFromQuery(query, queryLang, variable);
} catch (MelcoeXacmlException e) {
throw new AttributeFinderException(e.getMessage(), e);
}
}
Set<AttributeValue> bagValues = new HashSet<AttributeValue>();
logger.debug("Attribute values found: " + results.size());