コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 protected static Resource getResource(Statement s) {
   return AssemblerHelp.getResource(s);
 }