RepositoryConnection conn = source.getConnection();
RepositoryResult<Statement> facetI = conn.getStatements(focus, Facets.facets, (Value) null, false);
if (facetI.hasNext()) {
Statement facetStmt = (Statement) facetI.next();
Value facetsNode = facetStmt.getObject();
if (facetI.hasNext()) throw new UnresolvableException("More than one :facets value available");
if (facetsNode instanceof Resource && RDFList.isRDFList(source, (Resource) facetsNode)) {
RDFList facetRDFList = new RDFList(source, (Resource) facetsNode);
if (facetRDFList.isValid()) {
for (Iterator listI = facetRDFList.iterator(); listI.hasNext(); ) {
Resource facetNode = (Resource) listI.next();
Facet facet = new Facet(facetNode);
out.addFacet(facet);
}
} else {
throw new ParsingException(facetsNode.toString() + "is not a valid rdf:List");
}
}
}
facetI.close();
RepositoryResult<Statement> hidesI = conn.getStatements(focus, Facets.hides, (Value) null, false);
if (hidesI.hasNext()) {
Statement facetStmt = hidesI.next();
Value facetsNode = facetStmt.getObject();
if (hidesI.hasNext()) throw new UnresolvableException("More than one :hides value available");
if (facetsNode instanceof Resource && RDFList.isRDFList(source, (Resource) facetsNode)) {
RDFList facetRDFList = new RDFList(source, (Resource) facetsNode);
if (facetRDFList.isValid()) {
for (Iterator listI = facetRDFList.iterator(); listI.hasNext(); ) {
Resource facetNode = (Resource) listI.next();
Facet facet = new Facet(facetNode);
out.addHide(facet);
}
} else {
throw new ParsingException(facetsNode.toString() + "is not a valid rdf:List");
}
}
}
hidesI.close();
conn.close();
} catch (RepositoryException e) {
throw new UnresolvableException("Problem connecting to repository: " + e.getLocalizedMessage());
}
TypeSet forTypes = TypeSet.parse(source, focus);
out.setForTypes(forTypes);