Example #1
0
  @Override
  public boolean executeGetOnAddress(
      XDI3Segment[] contributorXris,
      XDI3Segment contributorsXri,
      XDI3Segment relativeTargetAddress,
      GetOperation operation,
      MessageResult messageResult,
      ExecutionContext executionContext)
      throws Xdi2MessagingException {

    messageResult
        .getGraph()
        .setStatement(
            XDI3Statement.fromRelationComponents(
                XDI3Segment.create("" + contributorsXri + "=markus"),
                XDI3Segment.create("" + "+friend"),
                XDI3Segment.create("" + contributorsXri + "=animesh")));

    return false;
  }
Example #2
0
  private static void read(Graph graph, BufferedReader bufferedReader)
      throws IOException, Xdi2ParseException {

    String line;
    int lineNr = 0;

    while ((line = bufferedReader.readLine()) != null) {

      lineNr++;

      line = line.trim();
      if (line.isEmpty()) continue;

      XDI3Statement statementXri;

      try {

        statementXri = XDI3Statement.create(line);
      } catch (Exception ex) {

        throw new Xdi2ParseException(
            "Parser problem at line " + lineNr + ": " + ex.getMessage(), ex);
      }

      // add the statement to the graph

      try {

        graph.setStatement(statementXri);
      } catch (Exception ex) {

        throw new Xdi2ParseException(
            "Graph problem at line " + lineNr + ": " + ex.getMessage(), ex);
      }
    }
  }