Re: parse one quad?
> On Mar 12, 2018, at 5:47 PM, Andy Seaborne wrote: > > One at a time and performance ... I know, it's true. I am actively searching for ways to NOT do this, but I'm in a tight architectural spot in which I'm trying to integrate two codebases that aren't mine. Essentially, I'm pulling individual fields from a database and dealing with them as RDF. Not what I want to be doing, certainly. I understand fully the poor setup inherent in this problem. > You could create a TokenizerText.makeTokenizerString and simply pull 4 tokens > out and then check end of stream or DOT. > Do you need the quad immediately or can you create a inout that t=you send > the string to and catch it in the StreamRDF, and reuse that framework across > quad parsing? Sort of-- just to make things even worse, the action is taking place in a class subclassing a type from the database codebase that explicitly warns not to keep any state. So reuse becomes difficult at best. I'm going to follow up on TokenizerFactory::makeTokenizerString, and also on some way I can get myself into a better position to do this work instead of grinding on it from the disadvantage in which I now find myself. Just as a matter of interest, it's an implementation of LDP [1] over Apache Cassandra. ajs6f [1] https://github.com/trellis-ldp/trellis > >Andy > > On 12/03/18 20:18, ajs6f wrote: >> org.apache.jena.sparql.core.Quad. That's enough for what I want to do. >> ajs6f >>> On Mar 12, 2018, at 4:17 PM, Martynas Jusevičius >>> wrote: >>> >>> So what are you going to parse the quad into, if not Dataset? >>> >>> On Mon, Mar 12, 2018 at 9:11 PM, ajs6f wrote: >>> Thanks, Martynas, but no; I don't have a Dataset (and don't need or want to build one for a single quad), and no InputStream (although I could get one from a String without too much fuss. RDFDataMgr or RDFParser are usually the best tools for parsing, but I'm looking for something a bit lighter-weight. ajs6f > On Mar 12, 2018, at 4:07 PM, Martynas Jusevičius wrote: > > Maybe this? > https://jena.apache.org/documentation/javadoc/arq/org/ apache/jena/riot/RDFDataMgr.html#read-org.apache.jena. query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- > > On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: > >> I've got a use case for parsing one quad (in NQuads form) from a String. >> I've been paging around through RIOT and other parts of Jena, but I just >> can't seem to find any way to do this without building up a bunch of >> auxiliary objects (like Readers or StreamRDFs, etc.). Performance is >> something of a concern, so I'd rather not build up any more than I have to. >> >> Am I missing something, or do we just not expose that functionality? (I'm >> inclined to bet that we _have_ to have impled it somewhere, just for our >> own sanity, but maybe not!) >> >> ajs6f >> >>
Re: parse one quad?
One at a time and performance ... You could create a TokenizerText.makeTokenizerString and simply pull 4 tokens out and then check end of stream or DOT. Do you need the quad immediately or can you create a inout that t=you send the string to and catch it in the StreamRDF, and reuse that framework across quad parsing? Andy On 12/03/18 20:18, ajs6f wrote: org.apache.jena.sparql.core.Quad. That's enough for what I want to do. ajs6f On Mar 12, 2018, at 4:17 PM, Martynas Jusevičius wrote: So what are you going to parse the quad into, if not Dataset? On Mon, Mar 12, 2018 at 9:11 PM, ajs6f wrote: Thanks, Martynas, but no; I don't have a Dataset (and don't need or want to build one for a single quad), and no InputStream (although I could get one from a String without too much fuss. RDFDataMgr or RDFParser are usually the best tools for parsing, but I'm looking for something a bit lighter-weight. ajs6f On Mar 12, 2018, at 4:07 PM, Martynas Jusevičius wrote: Maybe this? https://jena.apache.org/documentation/javadoc/arq/org/ apache/jena/riot/RDFDataMgr.html#read-org.apache.jena. query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: I've got a use case for parsing one quad (in NQuads form) from a String. I've been paging around through RIOT and other parts of Jena, but I just can't seem to find any way to do this without building up a bunch of auxiliary objects (like Readers or StreamRDFs, etc.). Performance is something of a concern, so I'd rather not build up any more than I have to. Am I missing something, or do we just not expose that functionality? (I'm inclined to bet that we _have_ to have impled it somewhere, just for our own sanity, but maybe not!) ajs6f
Re: parse one quad?
org.apache.jena.sparql.core.Quad. That's enough for what I want to do. ajs6f > On Mar 12, 2018, at 4:17 PM, Martynas Jusevičius > wrote: > > So what are you going to parse the quad into, if not Dataset? > > On Mon, Mar 12, 2018 at 9:11 PM, ajs6f wrote: > >> Thanks, Martynas, but no; I don't have a Dataset (and don't need or want >> to build one for a single quad), and no InputStream (although I could get >> one from a String without too much fuss. >> >> RDFDataMgr or RDFParser are usually the best tools for parsing, but I'm >> looking for something a bit lighter-weight. >> >> ajs6f >> >>> On Mar 12, 2018, at 4:07 PM, Martynas Jusevičius >> wrote: >>> >>> Maybe this? >>> https://jena.apache.org/documentation/javadoc/arq/org/ >> apache/jena/riot/RDFDataMgr.html#read-org.apache.jena. >> query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- >>> >>> On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: >>> I've got a use case for parsing one quad (in NQuads form) from a String. I've been paging around through RIOT and other parts of Jena, but I just can't seem to find any way to do this without building up a bunch of auxiliary objects (like Readers or StreamRDFs, etc.). Performance is something of a concern, so I'd rather not build up any more than I have >> to. Am I missing something, or do we just not expose that functionality? >> (I'm inclined to bet that we _have_ to have impled it somewhere, just for our own sanity, but maybe not!) ajs6f >> >>
Re: parse one quad?
So what are you going to parse the quad into, if not Dataset? On Mon, Mar 12, 2018 at 9:11 PM, ajs6f wrote: > Thanks, Martynas, but no; I don't have a Dataset (and don't need or want > to build one for a single quad), and no InputStream (although I could get > one from a String without too much fuss. > > RDFDataMgr or RDFParser are usually the best tools for parsing, but I'm > looking for something a bit lighter-weight. > > ajs6f > > > On Mar 12, 2018, at 4:07 PM, Martynas Jusevičius > wrote: > > > > Maybe this? > > https://jena.apache.org/documentation/javadoc/arq/org/ > apache/jena/riot/RDFDataMgr.html#read-org.apache.jena. > query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- > > > > On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: > > > >> I've got a use case for parsing one quad (in NQuads form) from a String. > >> I've been paging around through RIOT and other parts of Jena, but I just > >> can't seem to find any way to do this without building up a bunch of > >> auxiliary objects (like Readers or StreamRDFs, etc.). Performance is > >> something of a concern, so I'd rather not build up any more than I have > to. > >> > >> Am I missing something, or do we just not expose that functionality? > (I'm > >> inclined to bet that we _have_ to have impled it somewhere, just for our > >> own sanity, but maybe not!) > >> > >> ajs6f > >> > >> > >
Re: parse one quad?
Thanks, Martynas, but no; I don't have a Dataset (and don't need or want to build one for a single quad), and no InputStream (although I could get one from a String without too much fuss. RDFDataMgr or RDFParser are usually the best tools for parsing, but I'm looking for something a bit lighter-weight. ajs6f > On Mar 12, 2018, at 4:07 PM, Martynas Jusevičius > wrote: > > Maybe this? > https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html#read-org.apache.jena.query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- > > On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: > >> I've got a use case for parsing one quad (in NQuads form) from a String. >> I've been paging around through RIOT and other parts of Jena, but I just >> can't seem to find any way to do this without building up a bunch of >> auxiliary objects (like Readers or StreamRDFs, etc.). Performance is >> something of a concern, so I'd rather not build up any more than I have to. >> >> Am I missing something, or do we just not expose that functionality? (I'm >> inclined to bet that we _have_ to have impled it somewhere, just for our >> own sanity, but maybe not!) >> >> ajs6f >> >>
Re: parse one quad?
Maybe this? https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html#read-org.apache.jena.query.Dataset-java.io.InputStream-org.apache.jena.riot.Lang- On Mon, Mar 12, 2018 at 8:46 PM, ajs6f wrote: > I've got a use case for parsing one quad (in NQuads form) from a String. > I've been paging around through RIOT and other parts of Jena, but I just > can't seem to find any way to do this without building up a bunch of > auxiliary objects (like Readers or StreamRDFs, etc.). Performance is > something of a concern, so I'd rather not build up any more than I have to. > > Am I missing something, or do we just not expose that functionality? (I'm > inclined to bet that we _have_ to have impled it somewhere, just for our > own sanity, but maybe not!) > > ajs6f > >