Examples of GraphNode


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

   */
  @GET
  @Produces({"*/*"})
  public Object getResource(@Context UriInfo uriInfo) {
    final UriRef uri = new UriRef(uriInfo.getAbsolutePath().toString());
      final GraphNode graphNode = getResourceAsGraphNode(uriInfo);
    if (graphNode == null) {
      return resourceUnavailable(uri, uriInfo);
    }
    InfoDiscobit infoDiscobit = InfoDiscobit.createInstance(graphNode);
    if (infoDiscobit != null) {
View Full Code Here

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

    }
  }

  private GraphNode getResourceAsGraphNode(UriInfo uriInfo) {
    final UriRef uri = new UriRef(uriInfo.getAbsolutePath().toString());
    GraphNode result = graphNodeProvider.getLocal(uri);
    //could chck if nodeContext > 0, but this would be less efficient
    TripleCollection tc = result.getGraph();
    if (tc.filter(uri, null, null).hasNext()) {
      return result;
    }
    if (tc.filter(null, null, uri).hasNext()) {
      return result;
View Full Code Here

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

      String depthHeader = WebDavUtils.getHeaderAsString(headers, "Depth");
      if (depthHeader == null) {
        depthHeader = WebDavUtils.infinite;
      }
      final MGraph mGraph = cgProvider.getContentGraph();
      GraphNode node = new GraphNode(nodeUri, mGraph);
      if (body != null) {
        Document requestDoc = WebDavUtils.sourceToDocument(body);
        Node propfindNode = WebDavUtils.getNode(requestDoc, WebDavUtils.propfind);
        Node requestNode = WebDavUtils.getFirstChild(propfindNode);
        String requestType = requestNode.getLocalName();
View Full Code Here

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

      return resourceUnavailable(nodeUri, uriInfo);
    }
    try {
      Document requestDoc = WebDavUtils.sourceToDocument(body);
      final MGraph mGraph = cgProvider.getContentGraph();
      GraphNode node = new GraphNode(nodeUri, mGraph);
      NodeList propsToSet = null;
      NodeList propsToRemove = null;
      Node proppatchNode = WebDavUtils.getNode(requestDoc, WebDavUtils.proppatch);
      NodeList childNodes = proppatchNode.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
View Full Code Here

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

   */
  @MOVE
  public Response move(@Context UriInfo uriInfo, @Context HttpHeaders headers) {
    UriRef nodeUri = new UriRef(uriInfo.getAbsolutePath().toString());
    final LockableMGraph mGraph = cgProvider.getContentGraph();
    GraphNode node = new GraphNode(nodeUri, mGraph);
    String targetString = WebDavUtils.getHeaderAsString(headers,
          "Destination");
    UriRef targetUri = new UriRef(targetString);
    String overwriteHeader = WebDavUtils.getHeaderAsString(headers, "Overwrite");
    boolean overwriteTarget = "T".equalsIgnoreCase(overwriteHeader);
    if (nodeAtUriExists(targetUri)) {
      if (overwriteTarget) {
        new GraphNode(targetUri, mGraph).deleteNodeContext();
      } else {
        return Response.status(Status.PRECONDITION_FAILED).build();
      }
    }
    Lock l = mGraph.getLock().writeLock();
    l.lock();
    try {
      Iterator<Triple> oldParentTripleIter
          = mGraph.filter(nodeUri, HIERARCHY.parent, null);
      if (oldParentTripleIter.hasNext()) {
        oldParentTripleIter.next();
        oldParentTripleIter.remove();
      }
      while (oldParentTripleIter.hasNext()) {
        logger.error("more than one parent statement: "+oldParentTripleIter.next());
        oldParentTripleIter.remove();
      }
      Lock writeLock = node.writeLock();
      writeLock.lock();
      try {
        node.replaceWith(targetUri);
      } finally {
        writeLock.unlock();
      }
      new CollectionCreator(mGraph).createContainingCollections(targetUri);
      try {
View Full Code Here

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

    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

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

        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

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

      }
    } finally {
      readLock.unlock();
    }

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

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

  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

Examples of org.drools.beliefs.graph.GraphNode

        this.graph = graph;
        adjacencyMatrix = new boolean[graph.size()][graph.size()];

        for (GraphNode<BayesVariable> v : graph ) {
            for (Edge e1 : v.getInEdges()) {
                GraphNode pV1 = graph.getNode(e1.getOutGraphNode().getId());
                connect(adjacencyMatrix, pV1.getId(), v.getId());
            }
        }
    }
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.