コード例 #1
0
  public List<ReMSerialisation> getReMSerialisations() throws OREException {
    try {
      List<ReMSerialisation> serialisations = new ArrayList<ReMSerialisation>();
      StmtIterator itr = res.listProperties(ORE.isDescribedBy);
      while (itr.hasNext()) {
        Statement statement = itr.nextStatement();
        Resource resource = (Resource) statement.getObject();
        StmtIterator itr2 = resource.listProperties(DC.format);
        StmtIterator itr3 = resource.listProperties(OREX.isAuthoritativeFor);
        String mime = "application/octet-stream";
        if (itr2.hasNext()) {
          Statement stmt = itr2.nextStatement();
          mime = ((Literal) stmt.getObject()).getLexicalForm();
        }
        boolean authoritative = false;
        if (itr3.hasNext()) {
          authoritative = true;
        }
        ReMSerialisation serialisation = new ReMSerialisation(mime, new URI(resource.getURI()));
        serialisation.setAuthoritative(authoritative);

        serialisations.add(serialisation);
      }
      return serialisations;
    } catch (URISyntaxException e) {
      throw new OREException(e);
    }
  }