wiki:ApertureRDFMap

Version 3 (modified by sauermann, 19 years ago) (diff)

--

Unified functionality of java.util.Map with RDF graphs. Basically, it is a Map with key-value pairs, where one key value can have one value. The keys are restricted to URIs represented as Strings. The values are normally Strings but can be complex types. The RDF aspect is that the complex types and the key-value pairs are interpreted as RDF triples. Each key-value pair in the map is then interpreted as a triple of <subject-key-value>. The subject is the uri of the resource in question.

To keep this simple, each ApertureRDFMap creates its own little RDF graph, which should be as lightweight as possible.

/**
 * a combination of a Java Map and a RDF graph. Which means, you can add complex data
 * structures or simpler ones, as needed.
 * All Map-centric methods assume that the data is about the key-value pairs of the so-called
 * "TopResource", which is the resource whose metadata are defined in the map.
 * The RDFMap can also contain information about <b>related</b> data of the TopResource,
 * normally resources that are values in the top key-value pairs. These related resources
 * can be accessed and manipulated using the getRDF() method and the methods defined there.
 */
public interface RDFMap extends java.util.Map {

  /**
   * get the top resource that identifies usually the DataObject in question.
   */
  public Resource getTopResource();


  /**
   * get the RDF model behind this RDFMap. Returns a model that contains the TopResource and other
   * resources.
   * TODO: we have no clue which model to use. 
     The new sesame2 api has no convenience methods at all, and shifts everything 
     into the Model-Transaction. which leaves us with RDF2GO by Max Völkel or Melniks RDF model. 
     Both are cludgy, but RDF2Go might have a good trade-off.
   */
  public RDFModel asRDFModel();

}


Example implementation

public class SimpleRDFMap implements RDFMap  {
  
  /**
   * create a new simplerdfmap, passing the uri of the top-resource.
   * use the uri the extraction method had as input.
   */
  public RDFMap(String uri){

  }

}