On 21 November 2015 at 17:14, Andy Seaborne <[email protected]> wrote: which uses a java port of the Scala immutable collections. > > The triple indexing is SPO, POS, OSP > > i.e. > SPO = Map S to a map of P to O.
This is exactly what I was looking for. It's this kind indexing pattern that I want to abstract into SPO, POS and OSP instances of the RDF type class. Thanks! -- Rob > >> Kind regards, >> Lorenz >> >> [1] https://jena.apache.org/documentation/javadoc/jena/ >> >> Hi Andy, >>> >>> On 21 November 2015 at 16:12, Andy Seaborne <[email protected]> wrote: >>> >>> Graph in Jena is an interface (in Haskell, the type class presumably). >>> >>> >>> Yes, it sounds like Jena's Graph interface is similar to our RDF type >>> class. >>> >>> http://hackage.haskell.org/package/rdf4h-1.3.4/docs/Data-RDF.html#t:RDF >>> >>> With some simple query functions overloaded on all instances: >>> >>> http://hackage.haskell.org/package/rdf4h-1.3.4/docs/Data-RDF-Query.html >>> >>> >>> The only way to indirectly inspect the indexing is to find the class of >>>> the implementation of the Graph interface. >>>> >>> >>> How many implementations of Jena's Graph interface come bundled with the >>> Jena code base? Where can I find out about each Graph implementation, >>> namely on how they are indexing the graph? >>> >>> -- >>> Rob >>> >>> >>> On 20/11/15 14:54, Rob Stewart wrote: >>>> >>>> Hi, >>>>> >>>>> I maintain an RDF Haskell library, and I would like to look towards >>>>> Jena >>>>> for inspiration on improving the API. >>>>> >>>>> Currently, there are two RDF graph implementations in the library. 1) >>>>> storing the triples just as a list of (subject,predicate,object) >>>>> tuple of >>>>> node elements, and 2) storing as a map from subject to predicate >>>>> lists and >>>>> then for each predicate a map from predicate to object list. The >>>>> instance >>>>> names in the API for the RDF type class is not very intuitive to the >>>>> RDF >>>>> domain expert. Here are two use case examples: >>>>> >>>>> Right (rdf :: TriplesGraph) <- parseFile NTriplesParser "my_file.nt" >>>>> Right (rdf :: MGraph) <- parseFile NTriplesParser "my_file.nt" >>>>> >>>>> One might ask: what is the internal structure of `TriplesGraph` and >>>>> `MGraph`, it certainly isn't clear from their names. A better design >>>>> would >>>>> be for the user to choose the graph structure in memory that >>>>> reflects how >>>>> the triples are indexed, perhaps in line with some application specific >>>>> needs about how the RDF graph should be searched. For example, >>>>> indexed on >>>>> SP keys mapping to O, or SO mapping to P, or OP mapping to S, or S >>>>> mapping >>>>> to O, and so on. >>>>> >>>>> Where should I be looking in the Jena API, to find out what the API >>>>> design >>>>> is for providing Java programmers the ability to A) index a graph >>>>> whilst >>>>> it >>>>> is being populated with triples whilst parsing a source, and B) how to >>>>> index an already populated RDF graph? Does the Jena API allow the >>>>> programmer to inspect the indexing that has been applied to an RDF >>>>> graph >>>>> in >>>>> memory? E.g. can I find out whether an RDF graph in-memory is >>>>> indexed on >>>>> SO >>>>> mapping to P? If so, is this reflected by the instantiated class >>>>> holding >>>>> the data, e.g. (myGraph instanceof SOtoPGraph), or is it reflected by >>>>> method calls, e.g. bool indexedBySO(myGraph), or is it not possible to >>>>> inspect previous indexing routines on an in-memory RDF graph with Jena? >>>>> >>>>> Thanks! >>>>> >>>>> -- >>>>> Rob Stewart >>>>> >>>>> >>>>> >
