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

Examples of com.hp.hpl.jena.rdf.model.StmtIterator


        ? config.getVocabularyStore().getHighIndegreeProperties()
        : config.getVocabularyStore().getHighOutdegreeProperties();
    Map<Property, Integer> highCounts = isInverse
        ? highIndegreeProperties
        : highOutdegreeProperties;
    StmtIterator it = isInverse
        ? model.listStatements(null, null, resource)
        : resource.listProperties();
    Map<Property, Integer> valueCounts = new HashMap<Property, Integer>();
    while (it.hasNext()) {
      Property p = it.next().getPredicate();
      if (!valueCounts.containsKey(p)) {
        valueCounts.put(p, 0);
      }
      valueCounts.put(p, valueCounts.get(p) + 1);
    }
View Full Code Here


    List<Statement> o_stmts = new ArrayList<Statement>();
   
    // new statements to be added:
    List<Statement> n_stmts = new ArrayList<Statement>();
   
    StmtIterator existingStmts = model.listStatements();
    while ( existingStmts.hasNext() ) {
      Statement o_stmt = existingStmts.nextStatement();
      Resource sbj = o_stmt.getSubject();
      Property prd = o_stmt.getPredicate();
      RDFNode obj = o_stmt.getObject();
     
      boolean any_change = false;
View Full Code Here

    Resource ontRes = JenaUtil2.getFirstIndividual(model, OWL.Ontology);
    List<Statement> prexistStatements = null;
    if ( ontRes != null ) {
      prexistStatements = new ArrayList<Statement>();
//      log.info("Getting pre-existing properties for OWL.Ontology individual: " +ontRes.getURI());
      StmtIterator iter = ontRes.listProperties();
      while ( iter.hasNext() ) {
        Statement st = iter.nextStatement();
        prexistStatements.add(st);
     
    }

   
View Full Code Here

   
    // new statements to be added:
    List<Statement> n_stmts = new ArrayList<Statement>();
   
    // check all statements in the model:
    StmtIterator existingStmts = model.listStatements();
    while ( existingStmts.hasNext() ) {
      Statement o_stmt = existingStmts.nextStatement();
      Resource sbj = o_stmt.getSubject();
      Property prd = o_stmt.getPredicate();
      RDFNode obj = o_stmt.getObject();
     
      // will indicate that o_stmt is affected by the namespace change:
View Full Code Here

    Resource ontRes = JenaUtil2.getFirstIndividual(model, OWL.Ontology);
    List<Statement> prexistStatements = null;
    if ( ontRes != null ) {
      prexistStatements = new ArrayList<Statement>();
      log.info("Getting pre-existing properties for OWL.Ontology individual: " +ontRes.getURI());
      StmtIterator iter = ontRes.listProperties();
      while ( iter.hasNext() ) {
        Statement st = iter.nextStatement();
        prexistStatements.add(st);
     
    }

   
View Full Code Here

    if ( ont != null ) {
      prexistStatements = new ArrayList<Statement>();
      if ( log.isDebugEnabled() ) {
        log.debug("Getting pre-existing properties from Ontology: " +ont.getURI());
      }
      StmtIterator iter = ont.listProperties();
      while ( iter.hasNext() ) {
        Statement st = iter.nextStatement();
        prexistStatements.add(st);
     
    }

   
View Full Code Here

    Resource ontRes = JenaUtil2.getFirstIndividual(model, OWL.Ontology);
    List<Statement> prexistStatements = null;
    if ( ontRes != null ) {
      prexistStatements = new ArrayList<Statement>();
      log.info("Getting pre-existing properties for OWL.Ontology individual: " +ontRes.getURI());
      StmtIterator iter = ontRes.listProperties();
      while ( iter.hasNext() ) {
        Statement st = iter.nextStatement();
        prexistStatements.add(st);
     
    }

   
View Full Code Here

    }
  }

  // verbatim copy from JenaUtil except for the generics supportee by the recent jena version
  public static Resource getFirstIndividual(Model model, Resource resType) {
    StmtIterator iter = model.listStatements(null, RDF.type, resType);
    if (iter.hasNext()) {
      Statement sta = (Statement) iter.next();
      return (Resource) sta.getSubject();
    } else
      return null;
  }
View Full Code Here

      // Log.error messages have been already generated.
    }

    if ( false && log.isDebugEnabled() ) {
      log.debug("_listStatements:");
      StmtIterator iter = _model.listStatements();
      while (iter.hasNext()) {
        com.hp.hpl.jena.rdf.model.Statement sta = iter.nextStatement();
        Resource sjt = sta.getSubject();
        log.debug("      " +
            PrintUtil.print(sjt)
            + "   " +
            PrintUtil.print(sta.getPredicate().getURI())
View Full Code Here

    }

    Model termModel = ModelFactory.createDefaultModel();
   
    if ( true ) { // get all statements about the term
      StmtIterator iter = model.listStatements(termRes, (Property) null, (Property) null);
      if (iter.hasNext()) {
        while (iter.hasNext()) {
          com.hp.hpl.jena.rdf.model.Statement sta = iter.nextStatement();
         
          termModel.add(sta);
        }
      }
    }
   
    if ( true ) { // test for subclasses
      StmtIterator iter = model.listStatements(null, RDFS.subClassOf, termRes);
      if  ( iter.hasNext() ) {
        while ( iter.hasNext() ) {
          com.hp.hpl.jena.rdf.model.Statement sta = iter.nextStatement();
         
          termModel.add(sta);
        }
      }
    }
   

    if ( model instanceof OntModel ) {
      OntModel ontModel = (OntModel) model;
      ExtendedIterator<Individual> iter = ontModel.listIndividuals(termRes);
      if ( iter.hasNext() ) {
        while ( iter.hasNext() ) {
          Resource idv = (Resource) iter.next();

          termModel.add(idv, RDF.type, termRes);
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.StmtIterator

Copyright © 2018 www.massapicom. 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.