public Set<NamedNode> getAsserted(Set<Source> sources, Date moment,
Resource type) {
Set<NamedNode> result = new HashSet<NamedNode>();
for (Source source : sources) {
Resource sourceRes = metaModel.createResource(source.getURIRef());
ResIterator assertions = metaModel.listSubjectsWithProperty(
METAMODEL.asserter, sourceRes);
while (assertions.hasNext()) {
Resource assertion = assertions.nextResource();
Literal assertionTimeLit = assertion.getProperty(
METAMODEL.assertionTime).getLiteral();
Resource assertedComponent = assertion.getProperty(
METAMODEL.assertedComponent).getResource();
if (!assertedComponent.hasProperty(RDF.type, type)) {
continue;
}
Date assertionTime;
assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
.asCalendar().getTime();
/*
* try { assertionTime = new MillisDateFormat()
* .parse(assertionTimeLit.getLexicalForm()); } catch
* (ParseException e) { throw new RuntimeException(e); }
*/
if (moment.before(assertionTime)) {
continue;
}
Statement revocationTimeStmt = assertion
.getProperty(METAMODEL.revocationTime);
if (revocationTimeStmt != null) {
Literal revocationTimeLit = revocationTimeStmt.getLiteral();
Date revocationTime = ((XSDDateTime) revocationTimeLit
.getValue()).asCalendar().getTime();
// not before rather than after as in the moment of
// revocation it is revoked
if (!moment.before(revocationTime)) {
continue;
}
}
result.add(new NamedNodeImpl(assertedComponent.getURI()));
}
}
return result;
}