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

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


        model.add(bnode, RDF.predicate, RDF.type);
        model.add(bnode, RDF.object, RDFS.Resource);
        model.add(bnode, RDFS.comment, "we knew that before");
        StmtIterator stmts = model.listStatements(RDFS.Resource, null, (RDFNode)null);
        Statement returnedStmt = stmts.nextStatement();
        RSIterator rsIterator = returnedStmt.listReifiedStatements();
        Assert.assertTrue("got back reified statement", rsIterator.hasNext());
        //recreating jena-graph
        graph = new JenaGraph(mGraph);
        model = ModelFactory.createModelForGraph(graph);
        stmts = model.listStatements(RDFS.Resource, null, (RDFNode)null);
        returnedStmt = stmts.nextStatement();
        rsIterator = returnedStmt.listReifiedStatements();
        Assert.assertTrue("got back reified statement on recreated graph",
                rsIterator.hasNext());
    }
View Full Code Here


    model.add(bnode, RDF.predicate, RDF.type);
    model.add(bnode, RDF.object, RDFS.Resource);
    model.add(bnode, RDFS.comment, "we knew that before");
    StmtIterator stmts = model.listStatements(RDFS.Resource, null, (RDFNode)null);
    Statement returnedStmt = stmts.nextStatement();
    RSIterator rsIterator = returnedStmt.listReifiedStatements();
    Assert.assertTrue("got back reified statement", rsIterator.hasNext());
    //recreating jena-graph
    graph = new JenaGraph(mGraph);
    model = ModelFactory.createModelForGraph(graph);
    stmts = model.listStatements(RDFS.Resource, null, (RDFNode)null);
    returnedStmt = stmts.nextStatement();
    rsIterator = returnedStmt.listReifiedStatements();
    Assert.assertTrue("got back reified statement on recreated graph",
        rsIterator.hasNext());
  }
View Full Code Here

          final Statement stmt = iter.next();
          checkDelete(stmt);

          if (suppressReifications)
          {
            final RSIterator rIter = holder.getBaseItem()
                .listReifiedStatements(stmt);
            try
            {
              while (rIter.hasNext())
              {
                final ReifiedStatement rs = rIter.next();
                final ExtendedIterator<Statement> tIter = holder
                    .getBaseItem()
                    .listStatements(rs, RDF.subject,
                        stmt.getSubject())
                    .andThen(
                        holder.getBaseItem()
                            .listStatements(
                                rs,
                                RDF.predicate,
                                stmt.getPredicate()))
                    .andThen(
                        holder.getBaseItem()
                            .listStatements(
                                rs,
                                RDF.object,
                                stmt.getObject()));

                try
                {
                  while (tIter.hasNext())
                  {
                    checkDelete(tIter.next().asTriple());
                  }
                }
                finally
                {
                  tIter.close();
                }
              }
            }
            finally
            {
              rIter.close();
            }
          }
        }
      }
      finally
View Full Code Here

    {
      holder.getBaseItem().removeAllReifications(s);
    }
    else
    {
      final RSIterator iter = holder.getBaseItem().listReifiedStatements(
          s);
      try
      {
        while (iter.hasNext())
        {
          final ReifiedStatement rs = iter.next();
          checkDelete(new Triple(rs.asNode(), RDF.subject.asNode(),
              wildCardNode(s.getSubject())));
          checkDelete(new Triple(rs.asNode(), RDF.predicate.asNode(),
              wildCardNode(s.getPredicate())));
          checkDelete(new Triple(rs.asNode(), RDF.object.asNode(),
              wildCardNode(s.getObject())));
        }
        holder.getBaseItem().removeAllReifications(s);
      }
      finally
      {
        iter.close();
      }

    }
  }
View Full Code Here

  }

  @Override
  public SecuredStatement getStatementProperty( final Property p )
  {
    final RSIterator rsIter = holder.getBaseItem().listReifiedStatements();
    try
    {
      while (rsIter.hasNext())
      {
        final ReifiedStatement s = rsIter.next();
        if (s.hasProperty(p))
        {
          return SecuredStatementImpl.getInstance(getModel(),
              s.getProperty(p));
        }
      }
      throw new PropertyNotFoundException(p);
    }
    finally
    {
      rsIter.close();
    }
  }
View Full Code Here

  {
    checkUpdate();
    if (!canDelete(Triple.ANY))
    {
      StmtIterator iter = null;
      final RSIterator rsIter = holder.getBaseItem()
          .listReifiedStatements();
      try
      {
        while (rsIter.hasNext())
        {
          final ReifiedStatement stmt = rsIter.next();
          iter = stmt.listProperties();
          while (iter.hasNext())
          {
            final Statement s = iter.next();
            checkDelete(s);
          }
        }
      }
      finally
      {
        rsIter.close();
        if (iter != null)
        {
          iter.close();
        }
      }
View Full Code Here

  }

  @Override
  public SecuredResource getAnyReifiedStatement( final Statement s )
  {
    final RSIterator it = listReifiedStatements(s);
    if (it.hasNext())
    {
      try
      {
        return SecuredReifiedStatementImpl.getInstance(holder.getSecuredItem(),
            it.nextRS());
      }
      finally
      {
        it.close();
      }
    }
    else
    {
      return SecuredReifiedStatementImpl.getInstance(holder.getSecuredItem(),
View Full Code Here

  public boolean isReified( final Statement s )
  {
    checkRead();
    checkRead(s.asTriple());

    final RSIterator it = listReifiedStatements(s);
    try
    {
      return it.hasNext();
    }
    finally
    {
      it.close();
    }
  }
View Full Code Here

  /**
   * Get unneeded reifications.
   */
  public Collection getStatements(int max, Request request, Response response, HandlerChain chain) {

    RSIterator stmtIter = model.listReifiedStatements();
    Collection removingStmt = new ArrayList();
    int i = 0;
    while (stmtIter.hasNext()) {
      ReifiedStatement current = stmtIter.nextRS();
      StmtIterator properties = current.listProperties();
      if (containsNonRS(properties)) {
        continue;
      }
      if (model.contains(null, null, current)) {
View Full Code Here

  static Model getModelWithoutTemporaryStmts(Model model) {
    Model result = ModelFactory.createDefaultModel();
    StmtIterator stmtIter = model.listStatements();
    STATEMENT: while (stmtIter.hasNext()) {
      Statement currentStmt = stmtIter.nextStatement();
      RSIterator rsIter =currentStmt.listReifiedStatements();
      while (rsIter.hasNext()) {
        ReifiedStatement currentRS = rsIter.nextRS();
        if (currentRS.hasProperty(RDF.type, RWCF.Temporary)) {
          continue STATEMENT;
        }   
      }
      if (currentStmt.getSubject().hasProperty(RDF.type, RWCF.Temporary)) {
View Full Code Here

TOP

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

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.