/** * Check if relation type is registered predicate. * * @param predicate the predicate as URI * @throws InvalidContentException Thrown if predicate is invalid * @throws WebserverSystemException Thrown if internal error occur * @throws RelationPredicateNotFoundException Thrown if the predicate is not registered. */ private static void checkRelationType(final URI predicate) throws RelationPredicateNotFoundException { if (!ContentRelationsUtility.validPredicate(predicate)) { throw new RelationPredicateNotFoundException( "Predicate " + predicate + " is not on the registered predicate list. "); } }
/** * Retrieves a list of registered predicates which can be used to create content relations. * * @return String containing a list with registered predicates. * @throws InvalidContentException Thrown if a xml file with an ontology has invalid content * @throws InvalidXmlException Thrown if a xml file with an ontology is invalid rdf/xml * @throws SystemException e */ @Override public String retrieveRegisteredPredicates() throws InvalidContentException, InvalidXmlException, SystemException { final List<String> predicates = ContentRelationsUtility.getPredicates(); final Iterator<String> it = predicates.iterator(); final StringBuilder sb = new StringBuilder(); sb.append(Constants.XML_HEADER); sb.append("<registeredPredicates:predicates"); sb.append( " xmlns:registeredPredicates=\"http://www.escidoc.org/schemas/predicate-list/0.1\" >\n"); while (it.hasNext()) { sb.append("<registeredPredicates:predicate>"); sb.append(it.next()); sb.append("</registeredPredicates:predicate>\n"); } sb.append("</registeredPredicates:predicates>\n"); return sb.toString(); }