wiki:ApertureRDFMap

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.

It would now be possible to access the rdf map through a elaborate API like rdf2go, to make it simpler. Comment from an email: I've taken a look at rdf2go. Looks nice! It's still alpha-stage though, I don't know how bad that is. It's also Java 5 (at least that's what it said, I didn't get this from the Javadoc). I thought you would rather have a 1.4-compatible API? We can also take a look at jrdf and related approaches, but I have no experience how good they are. Maybe defining our own simple interface is then not such a bad idea after all, it seems rather trivial to do and then we at least have full control over it. If one of the other RDF APIs becomes a standard, whether ad hoc or standardized, we can always define our interface as a specialization of this interface and map our own methods to the standard versions.

Api solution?

as a hack, I would suggest to use the current Sesame 2 inmemmodel as it is. See wiki:ApertureRDF to see how this is done with Sesame 2.

/**
 * 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(java.net.URI uri){

  }

}

Last modified 12 years ago Last modified on 10/26/05 13:01:18