Package org.apache.clerezza.rdf.utils

Examples of org.apache.clerezza.rdf.utils.GraphNode$Acceptor


    if (!nodeAtUriExists(nodeUri)) {
      return Response.status(Status.NOT_FOUND).entity(
          uriInfo.getAbsolutePath()).type(MediaType.TEXT_PLAIN).build();
    }
    final LockableMGraph mGraph = cgProvider.getContentGraph();
    GraphNode node = new GraphNode(nodeUri, mGraph);
    node.deleteNodeContext();
    return Response.ok().build();
  }
View Full Code Here


        new UserComparator());
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      while (users.hasNext()) {
        sortedSet.add(new GraphNode(users.next(), systemGraph));
      }
    } finally {
      readLock.unlock();
    }
    List<GraphNode> userList = new ArrayList<GraphNode>();
    userList.addAll(sortedSet);

    if (from == null || from < 0) {
      logger.debug("Query parameter from is null or negative, set to 1");
      from = 0;
    }
    if (to == null || to < 0) {
      logger.debug("Query parameter to is null or negative, set to 10");
      to = 10;
    }
    if (to > userList.size()) {
      to = userList.size();
    }

    int prevFrom = from - 10;
    int nextTo = to + 10;

    if (prevFrom < 0) {
      prevFrom = 0;
    }
    if (nextTo > userList.size()) {
      nextTo = userList.size();
    }

    NonLiteral userOverviewPage = new BNode();
    List<Resource> resultList = new RdfList(userOverviewPage, resultGraph);
    for (int i = from; i < to; i++) {
      resultList.add(userList.get(i).getNode());
    }
   
    UnionMGraph unionGraph = new UnionMGraph(resultGraph, systemGraph);
   
    GraphNode result = new GraphNode(userOverviewPage, unionGraph);

    result.addProperty(RDF.type, USERMANAGER.UserOverviewPage);
    result.addProperty(RDF.type, PLATFORM.HeadedPage);
    result.addProperty(LIST.predecessor, new UriRef(uriInfo
        .getAbsolutePath().toString()
        + "?from=" + prevFrom + "&to=" + from));
    result.addProperty(LIST.successor, new UriRef(uriInfo.getAbsolutePath()
        .toString()
        + "?from=" + to + "&to=" + nextTo));
    result.addProperty(LIST.indexFrom, LiteralFactory.getInstance()
        .createTypedLiteral(from));
    result.addProperty(LIST.indexTo, LiteralFactory.getInstance()
        .createTypedLiteral(to));
    result.addProperty(LIST.length, LiteralFactory.getInstance()
        .createTypedLiteral(sortedSet.size()));
   
    return result;
  }
View Full Code Here

      }
    } finally {
      readLock.unlock();
    }

    GraphNode result = new GraphNode(addUserPage, new UnionMGraph(
        resultGraph, systemGraph, contentGraph));
    addAvailableRoles(result);
    return result;
  }
View Full Code Here

  public GraphNode getResource(@Context UriInfo uriInfo) {
    final MGraph contentGraph = cgProvider.getContentGraph();
    final String uriString = uriInfo.getAbsolutePath().toString();
    final UriRef indexUri = new UriRef(uriString+"index");
    if (contentGraph.filter(indexUri, null, null).hasNext()) {
      return new GraphNode(indexUri, contentGraph);
    }
    final UriRef uri = new UriRef(uriString);
    MGraph mGraph = new UnionMGraph(new SimpleMGraph(), contentGraph);
    final GraphNode graphNode = new GraphNode(uri, mGraph);
    graphNode.addProperty(RDF.type, PLATFORM.HeadedPage);

    UriRef collectionUri = new UriRef(uriInfo.getAbsolutePath().toString());
    return graphNode;
  }
View Full Code Here

        }
      }
      resultGraph.add(new TripleImpl(node, CUSTOMPROPERTY.customfield,
          customField));
    }
    return new GraphNode(node, new UnionMGraph(resultGraph, contentGraph));
  }
View Full Code Here

    if (user != null) {
      resultGraph.add(new TripleImpl(userPermissionPage,
          USERMANAGER.user, user));
      Iterator<NonLiteral> permissions = userManager
          .getPermissionsOfUser(user);
      return new GraphNode(userPermissionPage, new UnionMGraph(
          resultGraph, systemGraph));
     
    }
    throw new WebApplicationException(Response.status(Status.NOT_FOUND)
        .entity("User " + userName + "does not exist in our database")
View Full Code Here

          }
        } finally {
          readLock.unlock();
        }
      }
      GraphNode result = new GraphNode(updateUserPage,
          new UnionMGraph(resultGraph, systemGraph, contentGraph));
      addAvailableRoles(result);
      return result;
    }
    throw new WebApplicationException(Response.status(Status.NOT_FOUND).entity("User " + userName + " does not exist in our database").build());
View Full Code Here

    resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type,
        USERMANAGER.RoleOverviewPage));
    resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type,
        PLATFORM.HeadedPage));
   
    GraphNode result =  new GraphNode(roleOverviewPage,
        new UnionMGraph(resultGraph, systemGraph, cgProvider.getContentGraph()));
    addAvailableRoles(result);
    addBaseRoles(result);

View Full Code Here

    NonLiteral role = userManager.getRoleByTitle(title);
    if (role != null) {
      resultGraph.add(new TripleImpl(rolePermissionPage,
          USERMANAGER.role, role));
      return new GraphNode(rolePermissionPage, new UnionMGraph(
          resultGraph, systemGraph));

    }
    throw new WebApplicationException(Response.status(Status.NOT_FOUND)
        .entity("Role " + role + "does not exist in our database")
View Full Code Here

    resultGraph.add(new TripleImpl(node, RDF.type,
        PLATFORM.HeadedPage));

    resultGraph.add(new TripleImpl(node, USERMANAGER.role,
        new PlainLiteralImpl(role)));
    return new GraphNode(node, resultGraph);
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.utils.GraphNode$Acceptor

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.