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

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


  {
    for (int i = 0; i <= 5; i++)
    {
      model.read( getFileName("ontology/list" + i + ".rdf"));

      RDFList l0 = getListRoot(model);

      // get the tail n times, should be nil at the end
      for (int j = 0; j < i; j++)
      {
        l0 = l0.getTail();
      }

      Assert.assertTrue("Should have reached the end of the list after "
          + i + " getTail()'s", l0.isEmpty());
    }
  }
View Full Code Here


    final Property p = model.createProperty(TestList.NS, "p");

    // a list of the nil object, but not typed
    final Resource nil = RDF.nil;
    model.add(root, p, nil);
    final RDFList l0 = getListRoot(model);
    checkValid("valid1", l0, true);

    // add another node to the head of the list
    final Resource badList = model.createResource();
    model.getRequiredProperty(root, p).remove();
    model.add(root, p, badList);
    model.add(badList, RDF.type, RDF.List);

    final RDFList l1 = getListRoot(model);
    checkValid("valid2", l1, false);

    // checkValid( "valid3", l1, false );

    model.add(badList, RDF.first, "fred");
View Full Code Here

     * @param classes
     *            {@link OntClass}es from which union class will be created
     * @return {@link OntClass} instance.
     */
    public OntClass createUnionClass(List<Resource> classes) {
        RDFList list = ontModel.createList();
        for (Resource klass : classes) {
            list.cons(klass);
        }
        return createUnionClass(list);
    }
View Full Code Here

    {
      throw new IllegalArgumentException("RDFList may not be null");
    }

    // check that property has a securedModel.
    RDFList goodList = rdfList;
    if (goodList.getModel() == null)
    {
      goodList = securedModel.createList(rdfList.asJavaList().iterator());
    }

    final ItemHolder<RDFList, SecuredRDFList> holder = new ItemHolder<RDFList, SecuredRDFList>(
View Full Code Here

      return list.size() == 0 ? ModelFactory.createDefaultModel()
          .createList() : list.copy();
    }
    else
    {
      final RDFList copy = copy();
      if (list.size() > 0)
      {
        copy.concatenate(list.copy());
      }
      return copy;
    }
  }
View Full Code Here

   * @return the modified RDFList.
   */
  private RDFList baseRemove( final RDFList val )
  {

    RDFList prev = null;
    RDFList cell = holder.getBaseItem();
    final boolean searching = true;

    while (searching && !cell.isEmpty())
    {
      if (cell.equals(val))
      {
        // found the value to be removed
        final RDFList tail = cell.getTail();
        if (prev != null)
        {
          prev.setTail(tail);
        }

View Full Code Here

  @Override
  public RDFList remove( final RDFNode val )
  {
    checkUpdate();
    RDFList cell = null;
    boolean denied = false;

    if (!canDelete(new Triple(Node.ANY, listFirst().asNode(), val.asNode())))
    {
      // iterate over the deletable items
      final ExtendedIterator<RDFList> iter = getSecuredRDFListIterator(Action.Delete);// .mapWith(new
                                              // SecuredListMap());
      while (iter.hasNext())
      {
        cell = iter.next();

        if (val.equals(cell.getRequiredProperty(listFirst())
            .getObject()))
        {
          if (canDelete(new Triple(cell.asNode(), listFirst()
              .asNode(), val.asNode())))
          {
            return SecuredRDFListImpl.getInstance(getModel(),
                baseRemove(cell));
View Full Code Here

          final Triple t = new Triple(list.asNode(), listFirst()
              .asNode(), retval.asNode());
          final Triple t2 = new Triple(list.asNode(), listFirst()
              .asNode(), value.asNode());
          checkUpdate(t, t2);
          final RDFList base = (RDFList) list.getBaseItem();
          base.getRequiredProperty(listFirst()).changeObject(value);
          return retval;
        }
        else
        {
          idx++;
View Full Code Here

  public RDFList next()
  {
    if (hasNext())
    {
      found = null;
      final RDFList retval = current;
      incrementCurrent();
      return retval;
    }
    throw new NoSuchElementException();
  }
View Full Code Here

    Assert.assertNotNull("Root resource should not be null", root);

    final Resource listHead = root.getRequiredProperty(
        m.getProperty(TestList.NS + "p")).getResource();

    final RDFList l = listHead.as(RDFList.class);
    Assert.assertNotNull("as(RDFList) should not return null for root", l);

    return l;
  }
View Full Code Here

TOP

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

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.