Package com.hp.hpl.jena.gvs

Examples of com.hp.hpl.jena.gvs.GraphOverTime


    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    Iterator<Date> previousChanges = got.previousChanges(dateFormat
        .parse("20060920123618661"));
    assertEquals(dateFormat.parse("20060920123618661"), previousChanges
        .next());
    assertEquals(dateFormat.parse("19980920123600000"), previousChanges
        .next());
View Full Code Here


  public Clock getClock() {
    return clock;
  }

  public GraphOverTime getGraphOverTime(final Set<Source> sources) {
    return new GraphOverTime() {

      public Iterator<Date> followingChanges(Date d) {
        synchronized (BaseStoreImpl.this) {
          return getDateList(sources, d, true);
        }
View Full Code Here

   */
  private void handleSourcesGet(Set<Source> sources, Date moment,
      String[] resourceURIStrings, TypedResponse<Graph> response)
      throws HandlerException {

    GraphOverTime got = store.getGraphOverTime(sources);
    {
      Iterator<Date> previousIter = got.previousChanges(moment);
      List<String> previousDateStringList = new ArrayList<String>();
      int count = 0;
      while (previousIter.hasNext()) {
        if (count++ == 10) {
          break;
        }
        previousDateStringList.add(MillisDateFormat.instance
            .format(previousIter.next()));
      }
      Object[] previousArray = previousDateStringList.toArray();
      if (previousArray.length > 0) {
        response.setHeader(HeaderName.get("X-GVS-Previous"),
            previousArray);
      }
    }
    {
      Iterator<Date> followingIter = got.followingChanges(moment);
      List<String> previousDateStringList = new ArrayList<String>();
      int count = 0;
      while (followingIter.hasNext()) {
        if (count++ == 10) {
          break;
        }
        previousDateStringList.add(MillisDateFormat.instance
            .format(followingIter.next()));
      }
      Object[] previousArray = previousDateStringList.toArray();
      if (previousArray.length > 0) {
        response.setHeader(HeaderName.get("X-GVS-Following"),
            previousDateStringList.toArray());
      }
    }
    if (resourceURIStrings != null) {
      FCAGraph fcaGraph = got.getGraph(moment);
      Set<GroundedNode> onlyForGroundedNodes = new HashSet<GroundedNode>(
          resourceURIStrings.length);
      for (String uriString : resourceURIStrings) {
        onlyForGroundedNodes.add(new NamedNodeImpl(uriString));
      }
      response.setBody(fcaGraph.filter(onlyForGroundedNodes));
    } else {
      response.setBody(got.getGraph(moment));
    }
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.gvs.GraphOverTime

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.