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

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


  public void start() {
    int previousTrustedSourceSize = 0;
    while (trustedSources.size() > previousTrustedSourceSize) {
      previousTrustedSourceSize = trustedSources.size();
      Model currentModel = ModelFactory.createModelForGraph(store.getGraphOverTime(trustedSources).getGraph(new Date()));
      StmtIterator seeAlsoStmt = currentModel.listStatements(null, RDFS.seeAlso, (Resource)null);
      while(seeAlsoStmt.hasNext()) {
        Statement stmt = seeAlsoStmt.nextStatement();
        RDFNode object = stmt.getObject();
        try {
          Source seeAlsoSource = new SourceImpl(((Resource)object).getURI());
View Full Code Here


    static public void main(String...argv)
    {
        Store store = StoreFactory.create("sdb.ttl") ;
        Model model = SDBFactory.connectDefaultModel(store) ;
       
        StmtIterator sIter = model.listStatements() ;
        for ( ; sIter.hasNext() ; )
        {
            Statement stmt = sIter.nextStatement() ;
            System.out.println(stmt) ;
        }
View Full Code Here

      return wrapped.listPropertyValues(resourceIRI, property, isInverse);
    }
    Model all = describeResource(resourceIRI);
    Resource r = all.getResource(resourceIRI);
    StmtIterator it = isInverse
        ? all.listStatements(null, property, r)
        : all.listStatements(r, property, (RDFNode) null);
    Model result = ModelFactory.createDefaultModel();
    while (it.hasNext()) {
      result.add(it.next());
    }
View Full Code Here

    }
    Model all = describeResource(resourceIRI);
    Resource r = all.getResource(resourceIRI);
    StmtIterator it = isInverse
        ? all.listStatements(null, property, r)
        : all.listStatements(r, property, (RDFNode) null);
    Model result = ModelFactory.createDefaultModel();
    while (it.hasNext()) {
      result.add(it.next());
    }
    return result;
View Full Code Here

    public Collection<Property> get() {
      if (dataSource == null) return Collections.emptyList();
      if (cache != null) return cache;
      cache = new ArrayList<Property>();
      Model result = dataSource.listPropertyValues(type.getURI(), RDF.type, true);
      StmtIterator it = result.listStatements(null, RDF.type, type);
      while (it.hasNext()) {
        Resource r = it.next().getSubject();
        if (!r.isURIResource()) continue;
        cache.add(r.as(Property.class));
      }
View Full Code Here

   
    // remove blank nodes that don't have any properties
    boolean changes = true;
    while ( changes ) {
      changes = false;
      StmtIterator stmtIt = metadata.listStatements();
      List<Statement> remList = new ArrayList<Statement>();
      while (stmtIt.hasNext()) {
        Statement s = stmtIt.nextStatement();
        if (    s.getObject().isAnon()
             && ! ((Resource) s.getObject().as(Resource.class)).listProperties().hasNext() ) {
View Full Code Here

      model = _getGraphsModel();
    }
    if ( model == null ) {
      return null;
    }
    return model.listStatements().toList();
  }
 

  /**
   * {@link #init()} does the actual initialization.
View Full Code Here

    // the following shows the metadata ie. properties with vocabularyUri as subject:
    // false: not included to avoid cluttering the test output
    if ( false ) {
      Resource ontologyResource = ResourceFactory.createResource(vocabularyUri);
      StmtIterator describeMetatada = describeModel.listStatements(ontologyResource, null, (RDFNode) null);
      while ( describeMetatada.hasNext() ) {
        Statement stmt = describeMetatada.nextStatement();
        System.out.println("\t" +stmt.getPredicate()+ " -> " +stmt.getObject());
      }
    }
View Full Code Here

        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

      String propertyUrl = line[0];
      String label = line[1];
      builder.append(label);
      builder.append(": ");
     
      StmtIterator iter = model.listStatements(null, model.getProperty(propertyUrl), (Resource)null);
     
      while (iter.hasNext()) {
        Statement stmt = iter.nextStatement();
        builder.append(stmt.getObject().asNode().getLiteralValue().toString());
      }
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.