private static void addIntersections(Model result, Model schema, Statement s) { Resource type = s.getSubject(); List<RDFNode> types = asJavaList(AssemblerHelp.getResource(s)); Set<Resource> candidates = subjectSet(result, ANY, RDF.type, types.get(0)); for (int i = 1; i < types.size(); i += 1) removeElementsWithoutType(candidates, (Resource) types.get(i)); addTypeToAll(type, candidates); }
protected static void addSupertypes(Model result) { Model temp = ModelFactory.createDefaultModel(); for (StmtIterator it = result.listStatements(ANY, RDF.type, ANY); it.hasNext(); ) { Statement s = it.nextStatement(); Resource c = AssemblerHelp.getResource(s); for (StmtIterator subclasses = result.listStatements(c, RDFS.subClassOf, ANY); subclasses.hasNext(); ) { RDFNode type = subclasses.nextStatement().getObject(); // System.err.println( ">> adding super type: subject " + s.getSubject() + ", type " + type // ); temp.add(s.getSubject(), RDF.type, type); } } result.add(temp); }
protected static String getString(Statement s) { return AssemblerHelp.getString(s); }
protected static String getUniqueString(Resource root, Property property) { Statement s = getUniqueStatement(root, property); return s == null ? null : AssemblerHelp.getString(s); }
protected static Resource getResource(Statement s) { return AssemblerHelp.getResource(s); }