Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.Model.listStatements()


        QueryExecution qExec = QueryExecutionFactory.create(query, DatasetFactory.create(dsg)) ;
        try {
            qExec.setTimeout(abortTime);
            Model model = qExec.execDescribe();
            //ResultSet rs = qExec.execSelect() ;
            for(Iterator<Statement> stmIterator = model.listStatements(); stmIterator.hasNext();) {
                stmIterator.next();
                counter++;
            }
            return counter ;
        } finally { qExec.close() ; }
View Full Code Here


        GraphStore gs = GraphStoreFactory.create(m);
        UpdateRequest req = UpdateFactory.create("INSERT { ?s ?p ?o } WHERE { ?o ?p ?s }");
        UpdateAction.execute(req, gs);
       
        assertEquals(2, m.size());
        assertEquals(1, m.listStatements(anon, null, (RDFNode)null).toList().size());
        assertEquals(1, m.listStatements(null, null, anon).toList().size());
    }
}
View Full Code Here

        UpdateRequest req = UpdateFactory.create("INSERT { ?s ?p ?o } WHERE { ?o ?p ?s }");
        UpdateAction.execute(req, gs);
       
        assertEquals(2, m.size());
        assertEquals(1, m.listStatements(anon, null, (RDFNode)null).toList().size());
        assertEquals(1, m.listStatements(null, null, anon).toList().size());
    }
}
View Full Code Here

    Model model = JenaToClerezzaConverter.clerezzaMGraphToJenaModel(mGraph);
   
    /*
     * Print all the triples contained in the Jena Model.
     */
    StmtIterator stmtIt = model.listStatements();
    while(stmtIt.hasNext()){
      Statement statement = stmtIt.next();
      log.info(statement.toString());
    }
   
View Full Code Here

        try {
            // Run the method
            Set<Statement> inferred = service.runTask(ReasoningService.Tasks.ENRICH, input);

            // Prepare the input statements to check the output with
            Set<Statement> inputStatements = input.listStatements().toSet();

            boolean onlyInferred = true;
            log.info("Check for statements to be only the inferred ones");
            Set<Statement> badOnes = new HashSet<Statement>();
            for (Statement stat : inferred) {
View Full Code Here

        try {
            // Run the method
            Set<Statement> inferred = service.runTask(ReasoningService.Tasks.ENRICH,input, null, false, null);

            // Prepare the input statements to check the output with
            Set<Statement> inputStatements = input.listStatements().toSet();

            log.info("All the input statements must be in the inferred output");
            Set<Statement> notInOutput = new HashSet<Statement>();
            for (Statement stat : inputStatements) {
                if (!inferred.contains(stat)) {
View Full Code Here

                    }
                    rules.add(o);
                }
            }
            if (log.isDebugEnabled()) {
                log.debug("Input size is {} statements", input.listStatements().toSet().size());
            }
            result = executeJenaReasoningService(task, (JenaReasoningService) service, input, rules,
                targetGraphID, true, parameters);
        } else if (service instanceof OWLApiReasoningService) {
            OWLOntology input;
View Full Code Here

      for (File f : files) {
        if (FileUtils.getExtension(f.getName()) != null) {
          Model model = ModelFactory.createDefaultModel();
          InputStream s = new FileInputStream(f);
          model.read(s, null, "TURTLE");
          StmtIterator iterator = model.listStatements();
          while(iterator.hasNext()) {
            Statement st = iterator.next();
            String subject = st.getSubject().toString();
            String object = st.getObject().toString();
            String predicate = st.getPredicate().toString();
View Full Code Here

        }
       
        Model model = ModelFactory.createDefaultModel();
        InputStream s = new FileInputStream(new File(filepath));
    model.read(s, null, "TURTLE");
    StmtIterator iterator = model.listStatements();
    while(iterator.hasNext()) {
      Statement st = iterator.next();
      String subject = "<" + st.getSubject().toString() + ">";
      String object = "<" + st.getObject().toString() + ">";
      for (Entry<String, KR2RMLBloomFilter> entry : mapping.entrySet()) {
View Full Code Here

          checkCreate(s.asTriple());
          lst.add(s.asTriple());
        }
        final Model m = ModelFactory
            .createModelForGraph(new CollectionGraph(lst));
        holder.getBaseItem().add(m.listStatements());
      }
      finally
      {
        iter.close();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.