Commit aa1111ec authored by acoburn's avatar acoburn
Browse files

more refinement

parent b7ea6af0
......@@ -35,6 +35,7 @@ import java.util.Optional;
import org.apache.http.impl.client.LaxRedirectStrategy;
import org.apache.jena.rdf.model.InfModel;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFLanguages;
import org.apache.jena.vocabulary.RDF;
......@@ -90,8 +91,7 @@ public class EntailmentServiceImpl implements EntailmentService {
fullModel.listStatements()
// We don't care about rdfs:Class and rdfs:Resource types
.filterDrop(t -> t.asTriple().matches(null, RDF.type.asNode(), RDFS.Class.asNode()) ||
t.asTriple().matches(null, RDF.type.asNode(), RDFS.Resource.asNode()))
.filterDrop(s -> isRdfsClass(s) || isRdfsResource(s))
.filterDrop(t -> rdfsModel.contains(t.getSubject(), null))
.forEachRemaining(entailed::add);
......@@ -100,6 +100,14 @@ public class EntailmentServiceImpl implements EntailmentService {
return new ByteArrayInputStream(baos.toByteArray());
}
private boolean isRdfsClass(final Statement stmt) {
return stmt.getPredicate().equals(RDF.type) && stmt.getResource().equals(RDFS.Class);
}
private boolean isRdfsResource(final Statement stmt) {
return stmt.getPredicate().equals(RDF.type) && stmt.getResource().equals(RDFS.Resource);
}
private Optional<Lang> getRdfLanguage(final String contentType) {
return ofNullable(contentType).map(RDFLanguages::contentTypeToLang);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment