Ah, you use that code because using ja:graph in the way that you are using it requires distinguishing between named graphs and the default graph, whereas because I am requiring the use of ja:namedGraph to construct a named graph, that part of my code is simpler. This gives me to ask yet another question (sorry!). Should I be allowing the use of ja:graph to construct a named graph as you show? I had restricted it to the use of ja:namedGraph. Unfortunately, these predicates don’t appear in assembler.ttl and the versions in DatasetAssemblerVocab have no comments to clarify their use.
Speaking of the fact that there is a separate DatasetAssemblerVocab that contains ja:graph, ja:defaultGraph, and so forth: I added ja:MemoryDataset and ja:data directly to JA. Should they go in another class, specific to InMemoryDatasetAssembler? --- A. Soroka The University of Virginia Library > On Nov 5, 2015, at 12:57 PM, Andy Seaborne <[email protected]> wrote: > > On 05/11/15 17:22, A. Soroka wrote: >> I just pushed an update to simplify this PR as discussed. It looks pretty >> similar to what you are showing below, but I used ja:data in both places >> (i.e. into the dataset and into a given graph, default or named) to allow >> for directly reading files into either. If ja:data is on the root, it reads >> either quads into the dataset or triples into the default graph, depending >> on what is on the other end of the ja:data triple. If ja:data is on the >> object of a ja:namedGraph triple, it reads into the appropriate named graph >> as specified by a ja:graphName triple, so: >> >> root a ja:MemoryDataset ; >> ja:data <file://myQuads.nq> ; >> ja:data <file://myTriplesforDefaultGraph.nt> ; >> ja:namedGraph [ ja:graphName <info:mygraph> ; ja:data >> <file://someTriplesForMyGraph> ] . >> >> I don’t understand what you mean by the method readGraphDesc? Is that >> supposed to read an assembler description of some kind? I thought we were >> excising that? > > See earlier: it handles the [] case which takes a touch more code so I put it > a name to that. > >>> // May need better checking for expected Resource/String things. >>> private void readGraphDesc(Dataset dataset, Resource r) { >>> String gn = null ; >>> if ( r.hasProperty(pGraphName)) { >>> Resource rgn = r.getProperty(pGraphName).getResource() ; >>> gn = rgn.getURI() ; >>> } >>> String dataFn = getAsStringValue(r, data) ; >>> if ( gn == null ) >>> RDFDataMgr.read(dataset.getDefaultModel(), dataFn); >>> else >>> RDFDataMgr.read(dataset.getNamedModel(gn), dataFn); >>> }
