예제 #1
0
  public void clearAggregatedResources() throws OREException {
    // first, burn all the aggregated resources
    List<AggregatedResource> ars = this.getAggregatedResources();
    for (AggregatedResource ar : ars) {
      ar.empty();
    }

    // now remove references to them from the Aggregation
    StmtIterator itr = res.listProperties(ORE.aggregates);
    model.remove(itr);
  }
예제 #2
0
  public void addAggregatedResource(AggregatedResource resource) throws OREException {
    try {
      // have to validate to ensure that uri is not the same as the URI of
      // this object
      if (resource.getURI().equals(res.getURI())) {
        throw new OREException(
            "Cannot add an AggregatedResource with the same URI as its Aggregation");
      }

      // tell the aggregated resource who it is aggregated by
      resource.addAggregation(new URI(res.getURI()));

      // add the AggregatedResource Model to our internal model
      Resource ar = ((AggregatedResourceJena) resource).getResource();
      Model arModel = ((AggregatedResourceJena) resource).getModel();
      this.addModelToModel(arModel);

      // relate the aggregation to the aggregated resource
      res.addProperty(ORE.aggregates, ar);
    } catch (URISyntaxException e) {
      throw new OREException(e);
    }
  }