You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Brad Moran <bm...@pinnacle21.net> on 2013/08/08 21:33:45 UTC
tdbloader2 problem
I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
all my triples successfully loaded into a tdb stored in directory "tdb." I
am sure it is successfully loaded because I can run any query on it
successfully. So I try:
apache-jena-2.10.1/bin/tdbloader2
--loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
NetBeansProjects/mdrolder/trunk/tdb
And I get Exception in thread "main" org.apache.jena.atlas.AtlasException:
java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is a
directory).
Which makes sense, I just do not understand how I am supposed to load the
tdb though. Should I just use one of the files within the TDB?
Thanks,
Brad
Re: tdbloader2 problem
Posted by Dave Reynolds <da...@gmail.com>.
On 08/08/13 20:33, Brad Moran wrote:
> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
> all my triples successfully loaded into a tdb stored in directory "tdb." I
> am sure it is successfully loaded because I can run any query on it
> successfully. So I try:
>
> apache-jena-2.10.1/bin/tdbloader2
> --loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
> NetBeansProjects/mdrolder/trunk/tdb
AFAIK the --loc flag to tdbloader2 just takes one argument, the tdb
directory. You are telling it to build the tdb in luceneIndexes and then
load the tdb directory as if it were the source file.
Dave
>
> And I get Exception in thread "main" org.apache.jena.atlas.AtlasException:
> java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is a
> directory).
> Which makes sense, I just do not understand how I am supposed to load the
> tdb though. Should I just use one of the files within the TDB?
>
> Thanks,
> Brad
>
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
I am trying to construct a lucene text index for the jena TDB that I
already have built. From the documentation:
http://jena.apache.org/documentation/query/text-query.html#building-a-text-index
it seems I have to load the TDB using tdbloader(my TDB is quite large so I
decided to use tdbloader2) the I have to run textindexer using an assembler
file. Right now I am having trouble loading the TDB that needs to be
indexed.
I am doing this from terminal, text indexer does not take in a directory as
far as I know?:
java -cp $FUSEKI_HOME/fuseki-server.jar jena.textindexer --desc=assembler_file
On Fri, Aug 9, 2013 at 12:30 PM, Rob Vesse <rv...@yarcdata.com> wrote:
> Brad
>
> I still don't understand what you are trying to do here?
>
> If you already have a TDB dataset then you do not need to run tdbloader2
>
> If you need to pass a TDB dataset to another Jena utility such as Fuseki
> or the text indexer that expects a TDB location then you should simply
> pass in the directory path to the directory where the TDB dataset is
> located.
>
> Rob
>
>
>
> On 8/9/13 9:21 AM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>
> >I tried doing this with all files in my TDB:
> >
> >jena-2.10.2/apache-jena-2.10.2-SNAPSHOT/bin/tdbloader2 --loc
> >NetBeansProjects/mdr-older/trunk/tdb
> >NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GOSP.idn
> >NetBeansProjects/mdr-older/trunk/tdb/GPOS.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GPOS.idn
> >NetBeansProjects/mdr-older/trunk/tdb/GSPO.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GSPO.idn
> >NetBeansProjects/mdr-older/trunk/tdb/journal.jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/node2id.dat
> >NetBeansProjects/mdr-older/trunk/tdb/node2id.idn
> >NetBeansProjects/mdr-older/trunk/tdb/nodes.dat
> >NetBeansProjects/mdr-older/trunk/tdb/nodes.dat-jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/OSP.dat
> >NetBeansProjects/mdr-older/trunk/tdb/OSP.idn
> >NetBeansProjects/mdr-older/trunk/tdb/OSPG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/OSPG.idn
> >NetBeansProjects/mdr-older/trunk/tdb/POS.dat
> >NetBeansProjects/mdr-older/trunk/tdb/POS.idn
> >NetBeansProjects/mdr-older/trunk/tdb/POSG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/POSG.idn
> >NetBeansProjects/mdr-older/trunk/tdb/prefix2id.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefix2id.idn
> >NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat-jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.idn
> >NetBeansProjects/mdr-older/trunk/tdb/SPO.dat
> >NetBeansProjects/mdr-older/trunk/tdb/SPO.idn
> >NetBeansProjects/mdr-older/trunk/tdb/SPOG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/SPOG.idn
> >
> >Then get:
> >
> >11:58:38 -- TDB Bulk Loader Start
> > 11:58:38 Data phase
> >INFO Load: NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat -- 2013/08/09
> >11:58:40 EDT
> >Exception in thread "main" org.apache.jena.atlas.AtlasException:
> >java.nio.charset.MalformedInputException: Input length = 1
> >at org.apache.jena.atlas.io.IO.exception(IO.java:206)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStreamBu
> >ffered.java:79)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffered.j
> >ava:156)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffered.jav
> >a:139)
> >at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:251)
> >at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:244)
> >at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:169)
> >at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:108)
> >at
> >org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(TokenizerFa
> >ctory.java:41)
> >at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:130)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:115)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
> >at
> >com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTabl
> >eBuilder.java:163)
> >at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
> >at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
> >at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
> >at
> >com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTabl
> >eBuilder.java:81)
> >Caused by: java.nio.charset.MalformedInputException: Input length = 1
> >at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
> >at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:338)
> >at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
> >at java.io.InputStreamReader.read(InputStreamReader.java:184)
> >at java.io.Reader.read(Reader.java:140)
> >... 17 more
> >
> >
> >
> >Is it possible that I only need certain files from my TDB directory? I am
> >pretty sure my TDB is not malformed, because I have run a lot of queries
> >on
> >it successfully.
> >
> >
> >
> >On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
> >
> >> On 08/08/13 20:33, Brad Moran wrote:
> >>
> >>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
> >>>have
> >>> all my triples successfully loaded into a tdb stored in directory
> >>>"tdb." I
> >>> am sure it is successfully loaded because I can run any query on it
> >>> successfully. So I try:
> >>>
> >>> apache-jena-2.10.1/bin/**tdbloader2
> >>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
> >>> NetBeansProjects/mdrolder/**trunk/tdb
> >>>
> >>
> >>
> >> The command format is
> >>
> >> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
> >>
> >> The data comes from miles, not a directory.
> >>
> >> It does not take a directory and find all the files. You have to
> >> enumerate the files.
> >>
> >> Andy
> >>
> >>
> >>
> >>> And I get Exception in thread "main" org.apache.jena.atlas.**
> >>> AtlasException:
> >>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb
> >>>(Is
> >>> a
> >>> directory).
> >>> Which makes sense, I just do not understand how I am supposed to load
> >>>the
> >>> tdb though. Should I just use one of the files within the TDB?
> >>>
> >>> Thanks,
> >>> Brad
> >>>
> >>>
> >>
>
>
Re: Multiple derivations for backward chaining?
Posted by Dave Reynolds <da...@gmail.com>.
Hi Niranjan,
Sorry no.
You might want to take a look at prolog/xsb based engines like flora-2.
I don't know what they support in the way of derivation tracing but at
least with a full prolog engine you could have a wrapper that induces a
fail to retry the goals.
Dave
On 12/08/13 20:23, Niranjan Balasubramanian wrote:
> Dave
>
> Thanks.
>
> Yes, getting at *all* possible derivations is bound to be problematic. How about finding K traces through the derivation graph? Is there any way to force the backward-chaining procedure to run until the answer is found K times (via different paths) or until the search space is exhausted?
>
> ~ Niranjan.
>
>
> On Aug 12, 2013, at 11:01 AM, Dave Reynolds wrote:
>
>> On 12/08/13 17:47, Niranjan Balasubramanian wrote:
>>> Hello all,
>>>
>>> I am a new user. I need to generate all possible derivations for a statement inferred via backward chaining. Based on what I understand from the documentation and a small test case I wrote, it appears that Jena outputs only one derivation (and possibly stops inference as soon as the target statement is inferred). Is this true?
>>
>> Correct. Once Jena has an answer to the query it stops. It will record the derivation trace for that answer but will not check alternative derivations.
>>
>> [After all there can be a *very* large number of possible traces through the derivation graph.]
>>
>>> Are there other toolkits that support multiple derivations?
>>
>> Don't know.
>>
>> Dave
>>
>
Re: Multiple derivations for backward chaining?
Posted by Niranjan Balasubramanian <ni...@cs.washington.edu>.
Joshua
Thanks for explaining. I clearly misunderstood your output :-).
This is very helpful. I will explore this idea to get at possible derivations.
Thanks.
~ Niranjan
On Aug 14, 2013, at 9:55 AM, Joshua TAYLOR wrote:
> On Wed, Aug 14, 2013 at 12:12 PM, Niranjan Balasubramanian
> <ni...@cs.washington.edu> wrote:
>> Thanks for this example. From your output it seems that rule 1is derives the statement (:iron, :conducts, :electricity) and rule 2 derives (:iron, :conductorof, :electricity)
>>
>> I am more interested in finding out the possible ways in which the query statement: (:iron, :conductorOf, :electricity) can be derived.
>>
>> Given the following rules:
>>
>> @prefix : http://myexample.org/
>> [rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal) print(rule1 ?a )]
>> [rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]
>> (:iron rdf:type :Metal) <- .
>> (:iron :conducts :electricity) <- .
>>
>> I'd expect to see both rule 1 and rule 2 as two possible derivations.
>
> I think you've misunderstood my code, or its output. I used the same
> rules that you provided. Both rule1 and rule2 derive triples that have
> :conductorOf as their predicate:
>
> "[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal)
> print( rule1 ?a )]\n" +
> "[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]\n" +
>
> When these rules fire, they are producing triples of the form
>
> ?subject :conductorOf ?object
>
> Thus, the lines from the output
>
> rule1 http://myexample.org/iron
> rule2 http://myexample.org/iron http://myexample.org/electricity
>
> indicate that rule1 was fired with ?a bound to :iron, producing the
> triple ":iron :conductorOf :electricity", and that rule2 was fired
> with ?x bound to :iron, and ?z bound to :electricity, producing the
> triple ":iron :conductorOf :electricity". So it is not the case that
> "rule 1is derives the statement (:iron, :conducts, :electricity) and
> rule 2 derives (:iron, :conductorof, :electricity)". Instead, the
> output correspond to the two ways that that triple can be derived.
>
>> As Dave Reynolds pointed out in his reply this seems not doable with Jena as it stops inference as soon as the answer is found.
>
> If you ask specifically for the triple "iron conductorOf electricity",
> the rule engine will stop as soon as one derivation is found.
> However, if you ask for all triples (as I did in my example), the
> rules for both derivations will fire (and so we saw output for both
> rule1 and rule2).
>
> I agree that this method is nor perfect, as you do not get the
> *entire* derivation, but just the final step of it, but it does
> provide *some* way of finding out the different ways in which a triple
> of interest can be derived.
>
> //JT
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Joshua TAYLOR <jo...@gmail.com>.
On Wed, Aug 14, 2013 at 12:12 PM, Niranjan Balasubramanian
<ni...@cs.washington.edu> wrote:
> Thanks for this example. From your output it seems that rule 1is derives the statement (:iron, :conducts, :electricity) and rule 2 derives (:iron, :conductorof, :electricity)
>
> I am more interested in finding out the possible ways in which the query statement: (:iron, :conductorOf, :electricity) can be derived.
>
> Given the following rules:
>
> @prefix : http://myexample.org/
> [rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal) print(rule1 ?a )]
> [rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]
> (:iron rdf:type :Metal) <- .
> (:iron :conducts :electricity) <- .
>
> I'd expect to see both rule 1 and rule 2 as two possible derivations.
I think you've misunderstood my code, or its output. I used the same
rules that you provided. Both rule1 and rule2 derive triples that have
:conductorOf as their predicate:
"[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal)
print( rule1 ?a )]\n" +
"[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]\n" +
When these rules fire, they are producing triples of the form
?subject :conductorOf ?object
Thus, the lines from the output
rule1 http://myexample.org/iron
rule2 http://myexample.org/iron http://myexample.org/electricity
indicate that rule1 was fired with ?a bound to :iron, producing the
triple ":iron :conductorOf :electricity", and that rule2 was fired
with ?x bound to :iron, and ?z bound to :electricity, producing the
triple ":iron :conductorOf :electricity". So it is not the case that
"rule 1is derives the statement (:iron, :conducts, :electricity) and
rule 2 derives (:iron, :conductorof, :electricity)". Instead, the
output correspond to the two ways that that triple can be derived.
> As Dave Reynolds pointed out in his reply this seems not doable with Jena as it stops inference as soon as the answer is found.
If you ask specifically for the triple "iron conductorOf electricity",
the rule engine will stop as soon as one derivation is found.
However, if you ask for all triples (as I did in my example), the
rules for both derivations will fire (and so we saw output for both
rule1 and rule2).
I agree that this method is nor perfect, as you do not get the
*entire* derivation, but just the final step of it, but it does
provide *some* way of finding out the different ways in which a triple
of interest can be derived.
//JT
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Niranjan Balasubramanian <ni...@cs.washington.edu>.
Joshua,
Thanks for this example. From your output it seems that rule 1is derives the statement (:iron, :conducts, :electricity) and rule 2 derives (:iron, :conductorof, :electricity)
I am more interested in finding out the possible ways in which the query statement: (:iron, :conductorOf, :electricity) can be derived.
Given the following rules:
@prefix : http://myexample.org/
[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal) print(rule1 ?a )]
[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]
(:iron rdf:type :Metal) <- .
(:iron :conducts :electricity) <- .
I'd expect to see both rule 1 and rule 2 as two possible derivations.
As Dave Reynolds pointed out in his reply this seems not doable with Jena as it stops inference as soon as the answer is found.
~ Niranjan.
On Aug 12, 2013, at 1:28 PM, Joshua TAYLOR wrote:
> On Mon, Aug 12, 2013 at 4:19 PM, Joshua TAYLOR <jo...@gmail.com> wrote:
>>
>
> Sorry for so much replying to my own noise, but I'm twice mistaken
> now. The problem with the original ruleset is that Jena rules don't
> support the abbreviation 'a' for `rdf:type` and I'd naïvely copied the
> data into the rules. If you have a ruleset like
>
> @prefix : http://myexample.org/
> [rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal) print(
> rule1 ?a )]
> [rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]
> (:iron rdf:type :Metal) <- .
> (:iron :conducts :electricity) <- .
>
> and you create an infModel based on it, and iterate through the
> statements in the model, both rules will get triggered, as seen in the
> output:
>
> [http://myexample.org/iron,
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
> http://myexample.org/Metal]
> [http://myexample.org/iron, http://myexample.org/conducts,
> http://myexample.org/electricity]
> rule1 http://myexample.org/iron
> [http://myexample.org/iron, http://myexample.org/conductorOf,
> http://myexample.org/electricity]
> rule2 http://myexample.org/iron http://myexample.org/electricity
>
> which has three (as expected) triples, and two lines generated by the
> print statements. The output from print, since it's the last term in
> the rule, means that the rule has fired successfully and derived the
> appropriate triple. Here's code to reproduce:
>
> import java.io.BufferedReader;
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.InputStreamReader;
>
> import com.hp.hpl.jena.rdf.model.InfModel;
> import com.hp.hpl.jena.rdf.model.Model;
> import com.hp.hpl.jena.rdf.model.ModelFactory;
> import com.hp.hpl.jena.rdf.model.StmtIterator;
> import com.hp.hpl.jena.reasoner.Reasoner;
> import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
> import com.hp.hpl.jena.reasoner.rulesys.Rule;
>
>
> public class DerivationsFinder {
>
> final static String conductorRules = ""+
> "@prefix : http://myexample.org/\n" +
> "[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal)
> print( rule1 ?a )]\n" +
> "[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]\n" +
> "(:iron rdf:type :Metal) <- .\n" +
> "(:iron :conducts :electricity) <- .\n" +
> "";
>
> public static void main(String[] args) throws IOException {
> try ( final InputStream in = new ByteArrayInputStream(
> conductorRules.getBytes() );
> final InputStreamReader reader = new InputStreamReader( in );
> final BufferedReader buff = new BufferedReader( reader ) ) {
>
> final Reasoner reasoner = new GenericRuleReasoner( Rule.parseRules(
> Rule.rulesParserFromReader( buff )));
> final Model model = ModelFactory.createDefaultModel();
> final InfModel infModel = ModelFactory.createInfModel( reasoner, model );
>
> for ( final StmtIterator it = infModel.listStatements(); it.hasNext(); ) {
> System.out.println( it.next() );
> }
> }
> }
> }
>
>
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Joshua TAYLOR <jo...@gmail.com>.
On Mon, Aug 12, 2013 at 4:19 PM, Joshua TAYLOR <jo...@gmail.com> wrote:
> On Mon, Aug 12, 2013 at 4:11 PM, Joshua TAYLOR <jo...@gmail.com> wrote:
>> On Mon, Aug 12, 2013 at 3:23 PM, Niranjan Balasubramanian
>> <ni...@cs.washington.edu> wrote:
>>> Yes, getting at *all* possible derivations is bound to be problematic. How about finding K traces through the derivation graph? Is there any way to force the backward-chaining procedure to run until the answer is found K times (via different paths) or until the search space is exhausted?
>>
>> Depending on your ruleset and how much of the derivation you need, you
>> can do a lot with print statements in your rules. For instance
>>
>> @prefix ex: <http://example.org/> .
>>
>> [(ex:A ex:B ex:C) <-
>> print( derivation 1 )]
>> [(ex:A ex:B ex:C) <-
>> print( derivation 2 )]
>> [(ex:A ex:B ex:C) <-
>> print( derivation 3 )]
>>
>> contains three rules that will produce (A B C). When writing out an
>> inference model based on these rules, all three rules are fired, even
>> though the model only contains one statement (A B C). For instance,
>> here's code that iterates through the statements of an inference model
>> based on these rules:
>>
>> import java.io.BufferedReader;
>> import java.io.ByteArrayInputStream;
>> import java.io.IOException;
>> import java.io.InputStream;
>> import java.io.InputStreamReader;
>>
>> import com.hp.hpl.jena.rdf.model.InfModel;
>> import com.hp.hpl.jena.rdf.model.Model;
>> import com.hp.hpl.jena.rdf.model.ModelFactory;
>> import com.hp.hpl.jena.rdf.model.StmtIterator;
>> import com.hp.hpl.jena.reasoner.Reasoner;
>> import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
>> import com.hp.hpl.jena.reasoner.rulesys.Rule;
>>
>>
>> public class DerivationsFinder {
>> final static String ruleText = "" +
>> "@prefix ex: <http://example.org/> .\n" +
>> "\n" +
>> "[(ex:A ex:B ex:C) <-\n" +
>> " print( derivation 1 )]\n" +
>> "[(ex:A ex:B ex:C) <-\n" +
>> " print( derivation 2 )]\n" +
>> "[(ex:A ex:B ex:C) <-\n" +
>> " print( derivation 3 )]\n" +
>> "";
>>
>> public static void main(String[] args) throws IOException {
>> try ( final InputStream in = new ByteArrayInputStream( ruleText.getBytes() );
>> final InputStreamReader reader = new InputStreamReader( in );
>> final BufferedReader buff = new BufferedReader( reader ) ) {
>>
>> final Reasoner reasoner = new GenericRuleReasoner( Rule.parseRules(
>> Rule.rulesParserFromReader( buff )));
>> final Model model = ModelFactory.createDefaultModel();
>> final InfModel infModel = ModelFactory.createInfModel( reasoner, model );
>>
>> for ( final StmtIterator it = infModel.listStatements(); it.hasNext(); ) {
>> System.out.println( it.next() );
>> }
>> }
>> }
>> }
>>
>> The output is:
>>
>> derivation '1'^^http://www.w3.org/2001/XMLSchema#int
>> [http://example.org/A, http://example.org/B, http://example.org/C]
>> derivation '2'^^http://www.w3.org/2001/XMLSchema#int
>> derivation '3'^^http://www.w3.org/2001/XMLSchema#int
>>
>> If you can put enough debugging output in your rules, you should be
>> able to capture a bunch of the derivations.
>
> Hm. Trying out something like this on the rules that you provided
> doesn't seem to work for me, actually. Sorry. I'll take a bit more of
> a look, but I guess this isn't a great approach after all.
Sorry for so much replying to my own noise, but I'm twice mistaken
now. The problem with the original ruleset is that Jena rules don't
support the abbreviation 'a' for `rdf:type` and I'd naïvely copied the
data into the rules. If you have a ruleset like
@prefix : http://myexample.org/
[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal) print(
rule1 ?a )]
[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]
(:iron rdf:type :Metal) <- .
(:iron :conducts :electricity) <- .
and you create an infModel based on it, and iterate through the
statements in the model, both rules will get triggered, as seen in the
output:
[http://myexample.org/iron,
http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
http://myexample.org/Metal]
[http://myexample.org/iron, http://myexample.org/conducts,
http://myexample.org/electricity]
rule1 http://myexample.org/iron
[http://myexample.org/iron, http://myexample.org/conductorOf,
http://myexample.org/electricity]
rule2 http://myexample.org/iron http://myexample.org/electricity
which has three (as expected) triples, and two lines generated by the
print statements. The output from print, since it's the last term in
the rule, means that the rule has fired successfully and derived the
appropriate triple. Here's code to reproduce:
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.hp.hpl.jena.rdf.model.InfModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.reasoner.Reasoner;
import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
import com.hp.hpl.jena.reasoner.rulesys.Rule;
public class DerivationsFinder {
final static String conductorRules = ""+
"@prefix : http://myexample.org/\n" +
"[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal)
print( rule1 ?a )]\n" +
"[rule2: (?x :conductorOf ?z) <- (?x :conducts ?z) print( rule2 ?x ?z )]\n" +
"(:iron rdf:type :Metal) <- .\n" +
"(:iron :conducts :electricity) <- .\n" +
"";
public static void main(String[] args) throws IOException {
try ( final InputStream in = new ByteArrayInputStream(
conductorRules.getBytes() );
final InputStreamReader reader = new InputStreamReader( in );
final BufferedReader buff = new BufferedReader( reader ) ) {
final Reasoner reasoner = new GenericRuleReasoner( Rule.parseRules(
Rule.rulesParserFromReader( buff )));
final Model model = ModelFactory.createDefaultModel();
final InfModel infModel = ModelFactory.createInfModel( reasoner, model );
for ( final StmtIterator it = infModel.listStatements(); it.hasNext(); ) {
System.out.println( it.next() );
}
}
}
}
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Joshua TAYLOR <jo...@gmail.com>.
On Mon, Aug 12, 2013 at 4:11 PM, Joshua TAYLOR <jo...@gmail.com> wrote:
> On Mon, Aug 12, 2013 at 3:23 PM, Niranjan Balasubramanian
> <ni...@cs.washington.edu> wrote:
>> Yes, getting at *all* possible derivations is bound to be problematic. How about finding K traces through the derivation graph? Is there any way to force the backward-chaining procedure to run until the answer is found K times (via different paths) or until the search space is exhausted?
>
> Depending on your ruleset and how much of the derivation you need, you
> can do a lot with print statements in your rules. For instance
>
> @prefix ex: <http://example.org/> .
>
> [(ex:A ex:B ex:C) <-
> print( derivation 1 )]
> [(ex:A ex:B ex:C) <-
> print( derivation 2 )]
> [(ex:A ex:B ex:C) <-
> print( derivation 3 )]
>
> contains three rules that will produce (A B C). When writing out an
> inference model based on these rules, all three rules are fired, even
> though the model only contains one statement (A B C). For instance,
> here's code that iterates through the statements of an inference model
> based on these rules:
>
> import java.io.BufferedReader;
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.InputStreamReader;
>
> import com.hp.hpl.jena.rdf.model.InfModel;
> import com.hp.hpl.jena.rdf.model.Model;
> import com.hp.hpl.jena.rdf.model.ModelFactory;
> import com.hp.hpl.jena.rdf.model.StmtIterator;
> import com.hp.hpl.jena.reasoner.Reasoner;
> import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
> import com.hp.hpl.jena.reasoner.rulesys.Rule;
>
>
> public class DerivationsFinder {
> final static String ruleText = "" +
> "@prefix ex: <http://example.org/> .\n" +
> "\n" +
> "[(ex:A ex:B ex:C) <-\n" +
> " print( derivation 1 )]\n" +
> "[(ex:A ex:B ex:C) <-\n" +
> " print( derivation 2 )]\n" +
> "[(ex:A ex:B ex:C) <-\n" +
> " print( derivation 3 )]\n" +
> "";
>
> public static void main(String[] args) throws IOException {
> try ( final InputStream in = new ByteArrayInputStream( ruleText.getBytes() );
> final InputStreamReader reader = new InputStreamReader( in );
> final BufferedReader buff = new BufferedReader( reader ) ) {
>
> final Reasoner reasoner = new GenericRuleReasoner( Rule.parseRules(
> Rule.rulesParserFromReader( buff )));
> final Model model = ModelFactory.createDefaultModel();
> final InfModel infModel = ModelFactory.createInfModel( reasoner, model );
>
> for ( final StmtIterator it = infModel.listStatements(); it.hasNext(); ) {
> System.out.println( it.next() );
> }
> }
> }
> }
>
> The output is:
>
> derivation '1'^^http://www.w3.org/2001/XMLSchema#int
> [http://example.org/A, http://example.org/B, http://example.org/C]
> derivation '2'^^http://www.w3.org/2001/XMLSchema#int
> derivation '3'^^http://www.w3.org/2001/XMLSchema#int
>
> If you can put enough debugging output in your rules, you should be
> able to capture a bunch of the derivations.
Hm. Trying out something like this on the rules that you provided
doesn't seem to work for me, actually. Sorry. I'll take a bit more of
a look, but I guess this isn't a great approach after all.
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Joshua TAYLOR <jo...@gmail.com>.
On Mon, Aug 12, 2013 at 3:23 PM, Niranjan Balasubramanian
<ni...@cs.washington.edu> wrote:
> Yes, getting at *all* possible derivations is bound to be problematic. How about finding K traces through the derivation graph? Is there any way to force the backward-chaining procedure to run until the answer is found K times (via different paths) or until the search space is exhausted?
Depending on your ruleset and how much of the derivation you need, you
can do a lot with print statements in your rules. For instance
@prefix ex: <http://example.org/> .
[(ex:A ex:B ex:C) <-
print( derivation 1 )]
[(ex:A ex:B ex:C) <-
print( derivation 2 )]
[(ex:A ex:B ex:C) <-
print( derivation 3 )]
contains three rules that will produce (A B C). When writing out an
inference model based on these rules, all three rules are fired, even
though the model only contains one statement (A B C). For instance,
here's code that iterates through the statements of an inference model
based on these rules:
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.hp.hpl.jena.rdf.model.InfModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.reasoner.Reasoner;
import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
import com.hp.hpl.jena.reasoner.rulesys.Rule;
public class DerivationsFinder {
final static String ruleText = "" +
"@prefix ex: <http://example.org/> .\n" +
"\n" +
"[(ex:A ex:B ex:C) <-\n" +
" print( derivation 1 )]\n" +
"[(ex:A ex:B ex:C) <-\n" +
" print( derivation 2 )]\n" +
"[(ex:A ex:B ex:C) <-\n" +
" print( derivation 3 )]\n" +
"";
public static void main(String[] args) throws IOException {
try ( final InputStream in = new ByteArrayInputStream( ruleText.getBytes() );
final InputStreamReader reader = new InputStreamReader( in );
final BufferedReader buff = new BufferedReader( reader ) ) {
final Reasoner reasoner = new GenericRuleReasoner( Rule.parseRules(
Rule.rulesParserFromReader( buff )));
final Model model = ModelFactory.createDefaultModel();
final InfModel infModel = ModelFactory.createInfModel( reasoner, model );
for ( final StmtIterator it = infModel.listStatements(); it.hasNext(); ) {
System.out.println( it.next() );
}
}
}
}
The output is:
derivation '1'^^http://www.w3.org/2001/XMLSchema#int
[http://example.org/A, http://example.org/B, http://example.org/C]
derivation '2'^^http://www.w3.org/2001/XMLSchema#int
derivation '3'^^http://www.w3.org/2001/XMLSchema#int
If you can put enough debugging output in your rules, you should be
able to capture a bunch of the derivations.
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
Re: Multiple derivations for backward chaining?
Posted by Niranjan Balasubramanian <ni...@cs.washington.edu>.
Dave
Thanks.
Yes, getting at *all* possible derivations is bound to be problematic. How about finding K traces through the derivation graph? Is there any way to force the backward-chaining procedure to run until the answer is found K times (via different paths) or until the search space is exhausted?
~ Niranjan.
On Aug 12, 2013, at 11:01 AM, Dave Reynolds wrote:
> On 12/08/13 17:47, Niranjan Balasubramanian wrote:
>> Hello all,
>>
>> I am a new user. I need to generate all possible derivations for a statement inferred via backward chaining. Based on what I understand from the documentation and a small test case I wrote, it appears that Jena outputs only one derivation (and possibly stops inference as soon as the target statement is inferred). Is this true?
>
> Correct. Once Jena has an answer to the query it stops. It will record the derivation trace for that answer but will not check alternative derivations.
>
> [After all there can be a *very* large number of possible traces through the derivation graph.]
>
>> Are there other toolkits that support multiple derivations?
>
> Don't know.
>
> Dave
>
Re: Multiple derivations for backward chaining?
Posted by Dave Reynolds <da...@gmail.com>.
On 12/08/13 17:47, Niranjan Balasubramanian wrote:
> Hello all,
>
> I am a new user. I need to generate all possible derivations for a statement inferred via backward chaining. Based on what I understand from the documentation and a small test case I wrote, it appears that Jena outputs only one derivation (and possibly stops inference as soon as the target statement is inferred). Is this true?
Correct. Once Jena has an answer to the query it stops. It will record
the derivation trace for that answer but will not check alternative
derivations.
[After all there can be a *very* large number of possible traces through
the derivation graph.]
> Are there other toolkits that support multiple derivations?
Don't know.
Dave
Multiple derivations for backward chaining?
Posted by Niranjan Balasubramanian <ni...@cs.washington.edu>.
Hello all,
I am a new user. I need to generate all possible derivations for a statement inferred via backward chaining. Based on what I understand from the documentation and a small test case I wrote, it appears that Jena outputs only one derivation (and possibly stops inference as soon as the target statement is inferred). Is this true? Are there other toolkits that support multiple derivations?
Consider the following rules and facts:
@prefix : http://myexample.org
[rule1: (?a :conductorOf :electricity) <- (?a rdf:type :Metal)]
[rule2: (?x :conductorOf ?z) <- (?x :conducts ?y)]
:iron a :Metal .
:iron :conducts :electricity .
A query fact
:iron :conductorOf :electricity
can be inferred via two derivations -- using rule 1 or rule 2.
Using com.hp.hpl.jena.rdf.model.InfModel#getDerivation yields only one derivation (rule 1 in the example).
Thanks.
~ Niranjan.
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
Ok, thanks. I misunderstood the use of the term "load."
On Fri, Aug 9, 2013 at 12:43 PM, Andy Seaborne <an...@apache.org> wrote:
> On 09/08/13 17:41, Brad Moran wrote:
>
>> I am trying to construct a lucene text index for the jena TDB that I
>> already have built. From the documentation:
>> http://jena.apache.org/**documentation/query/text-**
>> query.html#building-a-text-**index<http://jena.apache.org/documentation/query/text-query.html#building-a-text-index>
>> it seems I have to load the TDB using tdbloader(my TDB is quite large so I
>> decided to use tdbloader2) the I have to run textindexer using an
>> assembler
>> file. Right now I am having trouble loading the TDB that needs to be
>> indexed.
>>
>
> You gave already loaded it. You don't need to load it again.
>
> Move on to the next step.
>
> (Rob's clarified the instructions:
>
> http://jena.staging.apache.**org/documentation/query/text-**
> query.html#building-a-text-**index<http://jena.staging.apache.org/documentation/query/text-query.html#building-a-text-index>
>
> )
>
> Andy
>
>
>>
>> On Fri, Aug 9, 2013 at 12:30 PM, Rob Vesse <rv...@yarcdata.com> wrote:
>>
>> Brad
>>>
>>> I still don't understand what you are trying to do here?
>>>
>>> If you already have a TDB dataset then you do not need to run tdbloader2
>>>
>>> If you need to pass a TDB dataset to another Jena utility such as Fuseki
>>> or the text indexer that expects a TDB location then you should simply
>>> pass in the directory path to the directory where the TDB dataset is
>>> located.
>>>
>>> Rob
>>>
>>>
>>>
>>> On 8/9/13 9:21 AM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>>>
>>> I tried doing this with all files in my TDB:
>>>>
>>>> jena-2.10.2/apache-jena-2.10.**2-SNAPSHOT/bin/tdbloader2 --loc
>>>> NetBeansProjects/mdr-older/**trunk/tdb
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GOSP.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GOSP.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GPOS.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GPOS.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GSPO.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/GSPO.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/journal.jrnl
>>>> NetBeansProjects/mdr-older/**trunk/tdb/node2id.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/node2id.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/nodes.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/nodes.dat-jrnl
>>>> NetBeansProjects/mdr-older/**trunk/tdb/OSP.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/OSP.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/OSPG.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/OSPG.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/POS.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/POS.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/POSG.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/POSG.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefix2id.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefix2id.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefixes.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefixes.dat-jrnl
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefixIdx.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/prefixIdx.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/SPO.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/SPO.idn
>>>> NetBeansProjects/mdr-older/**trunk/tdb/SPOG.dat
>>>> NetBeansProjects/mdr-older/**trunk/tdb/SPOG.idn
>>>>
>>>> Then get:
>>>>
>>>> 11:58:38 -- TDB Bulk Loader Start
>>>> 11:58:38 Data phase
>>>> INFO Load: NetBeansProjects/mdr-older/**trunk/tdb/GOSP.dat --
>>>> 2013/08/09
>>>> 11:58:40 EDT
>>>> Exception in thread "main" org.apache.jena.atlas.**AtlasException:
>>>> java.nio.charset.**MalformedInputException: Input length = 1
>>>> at org.apache.jena.atlas.io.IO.**exception(IO.java:206)
>>>> at
>>>> org.apache.jena.atlas.io.**CharStreamBuffered$**
>>>> SourceReader.fill(CharStreamBu
>>>> ffered.java:79)
>>>> at
>>>> org.apache.jena.atlas.io.**CharStreamBuffered.fillArray(**
>>>> CharStreamBuffered.j
>>>> ava:156)
>>>> at
>>>> org.apache.jena.atlas.io.**CharStreamBuffered.advance(**
>>>> CharStreamBuffered.jav
>>>> a:139)
>>>> at org.apache.jena.atlas.io.**PeekReader.advanceAndSet(**
>>>> PeekReader.java:251)
>>>> at org.apache.jena.atlas.io.**PeekReader.init(PeekReader.**java:244)
>>>> at org.apache.jena.atlas.io.**PeekReader.peekChar(**
>>>> PeekReader.java:169)
>>>> at org.apache.jena.atlas.io.**PeekReader.makeUTF8(**
>>>> PeekReader.java:108)
>>>> at
>>>> org.apache.jena.riot.tokens.**TokenizerFactory.**
>>>> makeTokenizerUTF8(TokenizerFa
>>>> ctory.java:41)
>>>> at org.apache.jena.riot.**RiotReader.createParser(**
>>>> RiotReader.java:130)
>>>> at org.apache.jena.riot.**RiotReader.parse(RiotReader.**java:115)
>>>> at org.apache.jena.riot.**RiotReader.parse(RiotReader.**java:93)
>>>> at org.apache.jena.riot.**RiotReader.parse(RiotReader.**java:66)
>>>> at
>>>> com.hp.hpl.jena.tdb.store.**bulkloader2.**CmdNodeTableBuilder.exec(**
>>>> CmdNodeTabl
>>>> eBuilder.java:163)
>>>> at arq.cmdline.CmdMain.**mainMethod(CmdMain.java:101)
>>>> at arq.cmdline.CmdMain.mainRun(**CmdMain.java:63)
>>>> at arq.cmdline.CmdMain.mainRun(**CmdMain.java:50)
>>>> at
>>>> com.hp.hpl.jena.tdb.store.**bulkloader2.**CmdNodeTableBuilder.main(**
>>>> CmdNodeTabl
>>>> eBuilder.java:81)
>>>> Caused by: java.nio.charset.**MalformedInputException: Input length = 1
>>>> at java.nio.charset.CoderResult.**throwException(CoderResult.**
>>>> java:277)
>>>> at sun.nio.cs.StreamDecoder.**implRead(StreamDecoder.java:**338)
>>>> at sun.nio.cs.StreamDecoder.read(**StreamDecoder.java:177)
>>>> at java.io.InputStreamReader.**read(InputStreamReader.java:**184)
>>>> at java.io.Reader.read(Reader.**java:140)
>>>> ... 17 more
>>>>
>>>>
>>>>
>>>> Is it possible that I only need certain files from my TDB directory? I
>>>> am
>>>> pretty sure my TDB is not malformed, because I have run a lot of queries
>>>> on
>>>> it successfully.
>>>>
>>>>
>>>>
>>>> On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 08/08/13 20:33, Brad Moran wrote:
>>>>>
>>>>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
>>>>>> have
>>>>>> all my triples successfully loaded into a tdb stored in directory
>>>>>> "tdb." I
>>>>>> am sure it is successfully loaded because I can run any query on it
>>>>>> successfully. So I try:
>>>>>>
>>>>>> apache-jena-2.10.1/bin/****tdbloader2
>>>>>> --loc=NetBeansProjects/****mdrolder/trunk/luceneIndexes
>>>>>> NetBeansProjects/mdrolder/****trunk/tdb
>>>>>>
>>>>>>
>>>>>
>>>>> The command format is
>>>>>
>>>>> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
>>>>>
>>>>> The data comes from miles, not a directory.
>>>>>
>>>>> It does not take a directory and find all the files. You have to
>>>>> enumerate the files.
>>>>>
>>>>> Andy
>>>>>
>>>>>
>>>>>
>>>>> And I get Exception in thread "main" org.apache.jena.atlas.**
>>>>>> AtlasException:
>>>>>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/****
>>>>>> trunk/tdb
>>>>>> (Is
>>>>>> a
>>>>>> directory).
>>>>>> Which makes sense, I just do not understand how I am supposed to load
>>>>>> the
>>>>>> tdb though. Should I just use one of the files within the TDB?
>>>>>>
>>>>>> Thanks,
>>>>>> Brad
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>>
>>
>
Re: tdbloader2 problem
Posted by Andy Seaborne <an...@apache.org>.
On 09/08/13 17:41, Brad Moran wrote:
> I am trying to construct a lucene text index for the jena TDB that I
> already have built. From the documentation:
> http://jena.apache.org/documentation/query/text-query.html#building-a-text-index
> it seems I have to load the TDB using tdbloader(my TDB is quite large so I
> decided to use tdbloader2) the I have to run textindexer using an assembler
> file. Right now I am having trouble loading the TDB that needs to be
> indexed.
You gave already loaded it. You don't need to load it again.
Move on to the next step.
(Rob's clarified the instructions:
http://jena.staging.apache.org/documentation/query/text-query.html#building-a-text-index
)
Andy
>
>
> On Fri, Aug 9, 2013 at 12:30 PM, Rob Vesse <rv...@yarcdata.com> wrote:
>
>> Brad
>>
>> I still don't understand what you are trying to do here?
>>
>> If you already have a TDB dataset then you do not need to run tdbloader2
>>
>> If you need to pass a TDB dataset to another Jena utility such as Fuseki
>> or the text indexer that expects a TDB location then you should simply
>> pass in the directory path to the directory where the TDB dataset is
>> located.
>>
>> Rob
>>
>>
>>
>> On 8/9/13 9:21 AM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>>
>>> I tried doing this with all files in my TDB:
>>>
>>> jena-2.10.2/apache-jena-2.10.2-SNAPSHOT/bin/tdbloader2 --loc
>>> NetBeansProjects/mdr-older/trunk/tdb
>>> NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/GOSP.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/GPOS.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/GPOS.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/GSPO.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/GSPO.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/journal.jrnl
>>> NetBeansProjects/mdr-older/trunk/tdb/node2id.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/node2id.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/nodes.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/nodes.dat-jrnl
>>> NetBeansProjects/mdr-older/trunk/tdb/OSP.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/OSP.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/OSPG.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/OSPG.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/POS.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/POS.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/POSG.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/POSG.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/prefix2id.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/prefix2id.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat-jrnl
>>> NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/SPO.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/SPO.idn
>>> NetBeansProjects/mdr-older/trunk/tdb/SPOG.dat
>>> NetBeansProjects/mdr-older/trunk/tdb/SPOG.idn
>>>
>>> Then get:
>>>
>>> 11:58:38 -- TDB Bulk Loader Start
>>> 11:58:38 Data phase
>>> INFO Load: NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat -- 2013/08/09
>>> 11:58:40 EDT
>>> Exception in thread "main" org.apache.jena.atlas.AtlasException:
>>> java.nio.charset.MalformedInputException: Input length = 1
>>> at org.apache.jena.atlas.io.IO.exception(IO.java:206)
>>> at
>>> org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStreamBu
>>> ffered.java:79)
>>> at
>>> org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffered.j
>>> ava:156)
>>> at
>>> org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffered.jav
>>> a:139)
>>> at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:251)
>>> at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:244)
>>> at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:169)
>>> at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:108)
>>> at
>>> org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(TokenizerFa
>>> ctory.java:41)
>>> at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:130)
>>> at org.apache.jena.riot.RiotReader.parse(RiotReader.java:115)
>>> at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
>>> at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
>>> at
>>> com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTabl
>>> eBuilder.java:163)
>>> at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
>>> at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>>> at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>>> at
>>> com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTabl
>>> eBuilder.java:81)
>>> Caused by: java.nio.charset.MalformedInputException: Input length = 1
>>> at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
>>> at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:338)
>>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
>>> at java.io.InputStreamReader.read(InputStreamReader.java:184)
>>> at java.io.Reader.read(Reader.java:140)
>>> ... 17 more
>>>
>>>
>>>
>>> Is it possible that I only need certain files from my TDB directory? I am
>>> pretty sure my TDB is not malformed, because I have run a lot of queries
>>> on
>>> it successfully.
>>>
>>>
>>>
>>> On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>>> On 08/08/13 20:33, Brad Moran wrote:
>>>>
>>>>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
>>>>> have
>>>>> all my triples successfully loaded into a tdb stored in directory
>>>>> "tdb." I
>>>>> am sure it is successfully loaded because I can run any query on it
>>>>> successfully. So I try:
>>>>>
>>>>> apache-jena-2.10.1/bin/**tdbloader2
>>>>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
>>>>> NetBeansProjects/mdrolder/**trunk/tdb
>>>>>
>>>>
>>>>
>>>> The command format is
>>>>
>>>> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
>>>>
>>>> The data comes from miles, not a directory.
>>>>
>>>> It does not take a directory and find all the files. You have to
>>>> enumerate the files.
>>>>
>>>> Andy
>>>>
>>>>
>>>>
>>>>> And I get Exception in thread "main" org.apache.jena.atlas.**
>>>>> AtlasException:
>>>>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb
>>>>> (Is
>>>>> a
>>>>> directory).
>>>>> Which makes sense, I just do not understand how I am supposed to load
>>>>> the
>>>>> tdb though. Should I just use one of the files within the TDB?
>>>>>
>>>>> Thanks,
>>>>> Brad
>>>>>
>>>>>
>>>>
>>
>>
>
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
I am trying to construct a lucene text index for the jena TDB that I
already have built. From the documentation:
http://jena.apache.org/documentation/query/text-query.html#building-a-text-index
it seems I have to load the TDB using tdbloader(my TDB is quite large so I
decided to use tdbloader2) the I have to run textindexer using an assembler
file. Right now I am having trouble loading the TDB that needs to be
indexed.
On Fri, Aug 9, 2013 at 12:30 PM, Rob Vesse <rv...@yarcdata.com> wrote:
> Brad
>
> I still don't understand what you are trying to do here?
>
> If you already have a TDB dataset then you do not need to run tdbloader2
>
> If you need to pass a TDB dataset to another Jena utility such as Fuseki
> or the text indexer that expects a TDB location then you should simply
> pass in the directory path to the directory where the TDB dataset is
> located.
>
> Rob
>
>
>
> On 8/9/13 9:21 AM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>
> >I tried doing this with all files in my TDB:
> >
> >jena-2.10.2/apache-jena-2.10.2-SNAPSHOT/bin/tdbloader2 --loc
> >NetBeansProjects/mdr-older/trunk/tdb
> >NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GOSP.idn
> >NetBeansProjects/mdr-older/trunk/tdb/GPOS.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GPOS.idn
> >NetBeansProjects/mdr-older/trunk/tdb/GSPO.dat
> >NetBeansProjects/mdr-older/trunk/tdb/GSPO.idn
> >NetBeansProjects/mdr-older/trunk/tdb/journal.jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/node2id.dat
> >NetBeansProjects/mdr-older/trunk/tdb/node2id.idn
> >NetBeansProjects/mdr-older/trunk/tdb/nodes.dat
> >NetBeansProjects/mdr-older/trunk/tdb/nodes.dat-jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/OSP.dat
> >NetBeansProjects/mdr-older/trunk/tdb/OSP.idn
> >NetBeansProjects/mdr-older/trunk/tdb/OSPG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/OSPG.idn
> >NetBeansProjects/mdr-older/trunk/tdb/POS.dat
> >NetBeansProjects/mdr-older/trunk/tdb/POS.idn
> >NetBeansProjects/mdr-older/trunk/tdb/POSG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/POSG.idn
> >NetBeansProjects/mdr-older/trunk/tdb/prefix2id.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefix2id.idn
> >NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat-jrnl
> >NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.dat
> >NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.idn
> >NetBeansProjects/mdr-older/trunk/tdb/SPO.dat
> >NetBeansProjects/mdr-older/trunk/tdb/SPO.idn
> >NetBeansProjects/mdr-older/trunk/tdb/SPOG.dat
> >NetBeansProjects/mdr-older/trunk/tdb/SPOG.idn
> >
> >Then get:
> >
> >11:58:38 -- TDB Bulk Loader Start
> > 11:58:38 Data phase
> >INFO Load: NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat -- 2013/08/09
> >11:58:40 EDT
> >Exception in thread "main" org.apache.jena.atlas.AtlasException:
> >java.nio.charset.MalformedInputException: Input length = 1
> >at org.apache.jena.atlas.io.IO.exception(IO.java:206)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStreamBu
> >ffered.java:79)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffered.j
> >ava:156)
> >at
> >org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffered.jav
> >a:139)
> >at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:251)
> >at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:244)
> >at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:169)
> >at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:108)
> >at
> >org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(TokenizerFa
> >ctory.java:41)
> >at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:130)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:115)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
> >at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
> >at
> >com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTabl
> >eBuilder.java:163)
> >at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
> >at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
> >at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
> >at
> >com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTabl
> >eBuilder.java:81)
> >Caused by: java.nio.charset.MalformedInputException: Input length = 1
> >at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
> >at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:338)
> >at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
> >at java.io.InputStreamReader.read(InputStreamReader.java:184)
> >at java.io.Reader.read(Reader.java:140)
> >... 17 more
> >
> >
> >
> >Is it possible that I only need certain files from my TDB directory? I am
> >pretty sure my TDB is not malformed, because I have run a lot of queries
> >on
> >it successfully.
> >
> >
> >
> >On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
> >
> >> On 08/08/13 20:33, Brad Moran wrote:
> >>
> >>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
> >>>have
> >>> all my triples successfully loaded into a tdb stored in directory
> >>>"tdb." I
> >>> am sure it is successfully loaded because I can run any query on it
> >>> successfully. So I try:
> >>>
> >>> apache-jena-2.10.1/bin/**tdbloader2
> >>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
> >>> NetBeansProjects/mdrolder/**trunk/tdb
> >>>
> >>
> >>
> >> The command format is
> >>
> >> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
> >>
> >> The data comes from miles, not a directory.
> >>
> >> It does not take a directory and find all the files. You have to
> >> enumerate the files.
> >>
> >> Andy
> >>
> >>
> >>
> >>> And I get Exception in thread "main" org.apache.jena.atlas.**
> >>> AtlasException:
> >>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb
> >>>(Is
> >>> a
> >>> directory).
> >>> Which makes sense, I just do not understand how I am supposed to load
> >>>the
> >>> tdb though. Should I just use one of the files within the TDB?
> >>>
> >>> Thanks,
> >>> Brad
> >>>
> >>>
> >>
>
>
Re: tdbloader2 problem
Posted by Rob Vesse <rv...@yarcdata.com>.
Brad
I still don't understand what you are trying to do here?
If you already have a TDB dataset then you do not need to run tdbloader2
If you need to pass a TDB dataset to another Jena utility such as Fuseki
or the text indexer that expects a TDB location then you should simply
pass in the directory path to the directory where the TDB dataset is
located.
Rob
On 8/9/13 9:21 AM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>I tried doing this with all files in my TDB:
>
>jena-2.10.2/apache-jena-2.10.2-SNAPSHOT/bin/tdbloader2 --loc
>NetBeansProjects/mdr-older/trunk/tdb
>NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat
>NetBeansProjects/mdr-older/trunk/tdb/GOSP.idn
>NetBeansProjects/mdr-older/trunk/tdb/GPOS.dat
>NetBeansProjects/mdr-older/trunk/tdb/GPOS.idn
>NetBeansProjects/mdr-older/trunk/tdb/GSPO.dat
>NetBeansProjects/mdr-older/trunk/tdb/GSPO.idn
>NetBeansProjects/mdr-older/trunk/tdb/journal.jrnl
>NetBeansProjects/mdr-older/trunk/tdb/node2id.dat
>NetBeansProjects/mdr-older/trunk/tdb/node2id.idn
>NetBeansProjects/mdr-older/trunk/tdb/nodes.dat
>NetBeansProjects/mdr-older/trunk/tdb/nodes.dat-jrnl
>NetBeansProjects/mdr-older/trunk/tdb/OSP.dat
>NetBeansProjects/mdr-older/trunk/tdb/OSP.idn
>NetBeansProjects/mdr-older/trunk/tdb/OSPG.dat
>NetBeansProjects/mdr-older/trunk/tdb/OSPG.idn
>NetBeansProjects/mdr-older/trunk/tdb/POS.dat
>NetBeansProjects/mdr-older/trunk/tdb/POS.idn
>NetBeansProjects/mdr-older/trunk/tdb/POSG.dat
>NetBeansProjects/mdr-older/trunk/tdb/POSG.idn
>NetBeansProjects/mdr-older/trunk/tdb/prefix2id.dat
>NetBeansProjects/mdr-older/trunk/tdb/prefix2id.idn
>NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat
>NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat-jrnl
>NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.dat
>NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.idn
>NetBeansProjects/mdr-older/trunk/tdb/SPO.dat
>NetBeansProjects/mdr-older/trunk/tdb/SPO.idn
>NetBeansProjects/mdr-older/trunk/tdb/SPOG.dat
>NetBeansProjects/mdr-older/trunk/tdb/SPOG.idn
>
>Then get:
>
>11:58:38 -- TDB Bulk Loader Start
> 11:58:38 Data phase
>INFO Load: NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat -- 2013/08/09
>11:58:40 EDT
>Exception in thread "main" org.apache.jena.atlas.AtlasException:
>java.nio.charset.MalformedInputException: Input length = 1
>at org.apache.jena.atlas.io.IO.exception(IO.java:206)
>at
>org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStreamBu
>ffered.java:79)
>at
>org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffered.j
>ava:156)
>at
>org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffered.jav
>a:139)
>at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:251)
>at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:244)
>at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:169)
>at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:108)
>at
>org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(TokenizerFa
>ctory.java:41)
>at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:130)
>at org.apache.jena.riot.RiotReader.parse(RiotReader.java:115)
>at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
>at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
>at
>com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTabl
>eBuilder.java:163)
>at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
>at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>at
>com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTabl
>eBuilder.java:81)
>Caused by: java.nio.charset.MalformedInputException: Input length = 1
>at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
>at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:338)
>at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
>at java.io.InputStreamReader.read(InputStreamReader.java:184)
>at java.io.Reader.read(Reader.java:140)
>... 17 more
>
>
>
>Is it possible that I only need certain files from my TDB directory? I am
>pretty sure my TDB is not malformed, because I have run a lot of queries
>on
>it successfully.
>
>
>
>On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 08/08/13 20:33, Brad Moran wrote:
>>
>>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
>>>have
>>> all my triples successfully loaded into a tdb stored in directory
>>>"tdb." I
>>> am sure it is successfully loaded because I can run any query on it
>>> successfully. So I try:
>>>
>>> apache-jena-2.10.1/bin/**tdbloader2
>>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
>>> NetBeansProjects/mdrolder/**trunk/tdb
>>>
>>
>>
>> The command format is
>>
>> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
>>
>> The data comes from miles, not a directory.
>>
>> It does not take a directory and find all the files. You have to
>> enumerate the files.
>>
>> Andy
>>
>>
>>
>>> And I get Exception in thread "main" org.apache.jena.atlas.**
>>> AtlasException:
>>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb
>>>(Is
>>> a
>>> directory).
>>> Which makes sense, I just do not understand how I am supposed to load
>>>the
>>> tdb though. Should I just use one of the files within the TDB?
>>>
>>> Thanks,
>>> Brad
>>>
>>>
>>
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
I tried doing this with all files in my TDB:
jena-2.10.2/apache-jena-2.10.2-SNAPSHOT/bin/tdbloader2 --loc
NetBeansProjects/mdr-older/trunk/tdb
NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat
NetBeansProjects/mdr-older/trunk/tdb/GOSP.idn
NetBeansProjects/mdr-older/trunk/tdb/GPOS.dat
NetBeansProjects/mdr-older/trunk/tdb/GPOS.idn
NetBeansProjects/mdr-older/trunk/tdb/GSPO.dat
NetBeansProjects/mdr-older/trunk/tdb/GSPO.idn
NetBeansProjects/mdr-older/trunk/tdb/journal.jrnl
NetBeansProjects/mdr-older/trunk/tdb/node2id.dat
NetBeansProjects/mdr-older/trunk/tdb/node2id.idn
NetBeansProjects/mdr-older/trunk/tdb/nodes.dat
NetBeansProjects/mdr-older/trunk/tdb/nodes.dat-jrnl
NetBeansProjects/mdr-older/trunk/tdb/OSP.dat
NetBeansProjects/mdr-older/trunk/tdb/OSP.idn
NetBeansProjects/mdr-older/trunk/tdb/OSPG.dat
NetBeansProjects/mdr-older/trunk/tdb/OSPG.idn
NetBeansProjects/mdr-older/trunk/tdb/POS.dat
NetBeansProjects/mdr-older/trunk/tdb/POS.idn
NetBeansProjects/mdr-older/trunk/tdb/POSG.dat
NetBeansProjects/mdr-older/trunk/tdb/POSG.idn
NetBeansProjects/mdr-older/trunk/tdb/prefix2id.dat
NetBeansProjects/mdr-older/trunk/tdb/prefix2id.idn
NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat
NetBeansProjects/mdr-older/trunk/tdb/prefixes.dat-jrnl
NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.dat
NetBeansProjects/mdr-older/trunk/tdb/prefixIdx.idn
NetBeansProjects/mdr-older/trunk/tdb/SPO.dat
NetBeansProjects/mdr-older/trunk/tdb/SPO.idn
NetBeansProjects/mdr-older/trunk/tdb/SPOG.dat
NetBeansProjects/mdr-older/trunk/tdb/SPOG.idn
Then get:
11:58:38 -- TDB Bulk Loader Start
11:58:38 Data phase
INFO Load: NetBeansProjects/mdr-older/trunk/tdb/GOSP.dat -- 2013/08/09
11:58:40 EDT
Exception in thread "main" org.apache.jena.atlas.AtlasException:
java.nio.charset.MalformedInputException: Input length = 1
at org.apache.jena.atlas.io.IO.exception(IO.java:206)
at
org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStreamBuffered.java:79)
at
org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffered.java:156)
at
org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffered.java:139)
at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:251)
at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:244)
at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:169)
at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:108)
at
org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(TokenizerFactory.java:41)
at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:130)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:115)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
at
com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTableBuilder.java:163)
at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
at
com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTableBuilder.java:81)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:338)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
... 17 more
Is it possible that I only need certain files from my TDB directory? I am
pretty sure my TDB is not malformed, because I have run a lot of queries on
it successfully.
On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
> On 08/08/13 20:33, Brad Moran wrote:
>
>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
>> all my triples successfully loaded into a tdb stored in directory "tdb." I
>> am sure it is successfully loaded because I can run any query on it
>> successfully. So I try:
>>
>> apache-jena-2.10.1/bin/**tdbloader2
>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
>> NetBeansProjects/mdrolder/**trunk/tdb
>>
>
>
> The command format is
>
> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
>
> The data comes from miles, not a directory.
>
> It does not take a directory and find all the files. You have to
> enumerate the files.
>
> Andy
>
>
>
>> And I get Exception in thread "main" org.apache.jena.atlas.**
>> AtlasException:
>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb (Is
>> a
>> directory).
>> Which makes sense, I just do not understand how I am supposed to load the
>> tdb though. Should I just use one of the files within the TDB?
>>
>> Thanks,
>> Brad
>>
>>
>
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
On Thu, Aug 8, 2013 at 5:34 PM, Andy Seaborne <an...@apache.org> wrote:
> On 08/08/13 20:33, Brad Moran wrote:
>
>> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
>> all my triples successfully loaded into a tdb stored in directory "tdb." I
>> am sure it is successfully loaded because I can run any query on it
>> successfully. So I try:
>>
>> apache-jena-2.10.1/bin/**tdbloader2
>> --loc=NetBeansProjects/**mdrolder/trunk/luceneIndexes
>> NetBeansProjects/mdrolder/**trunk/tdb
>>
>
>
> The command format is
>
> tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
>
> The data comes from miles, not a directory.
>
> It does not take a directory and find all the files. You have to
> enumerate the files.
>
> Andy
>
>
>
>> And I get Exception in thread "main" org.apache.jena.atlas.**
>> AtlasException:
>> java.io.FileNotFoundException: NetBeansProjects/mdrolder/**trunk/tdb (Is
>> a
>> directory).
>> Which makes sense, I just do not understand how I am supposed to load the
>> tdb though. Should I just use one of the files within the TDB?
>>
>> Thanks,
>> Brad
>>
>>
>
Re: tdbloader2 problem
Posted by Andy Seaborne <an...@apache.org>.
On 08/08/13 20:33, Brad Moran wrote:
> I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
> all my triples successfully loaded into a tdb stored in directory "tdb." I
> am sure it is successfully loaded because I can run any query on it
> successfully. So I try:
>
> apache-jena-2.10.1/bin/tdbloader2
> --loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
> NetBeansProjects/mdrolder/trunk/tdb
The command format is
tdbloader2 --loc LOC DATAFILE DATAFILE2 DATAFILE3 ....
The data comes from miles, not a directory.
It does not take a directory and find all the files. You have to
enumerate the files.
Andy
>
> And I get Exception in thread "main" org.apache.jena.atlas.AtlasException:
> java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is a
> directory).
> Which makes sense, I just do not understand how I am supposed to load the
> tdb though. Should I just use one of the files within the TDB?
>
> Thanks,
> Brad
>
Re: tdbloader2 problem
Posted by Rob Vesse <rv...@yarcdata.com>.
If you already have an existing TDB dataset then the tdbloader step is not
necessary.
You should be able to skip straight to the text indexing step.
Rob
On 8/8/13 12:49 PM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>I am trying to create a jena text search. So first I have to load the TDB
>store I have created. Like this:
>
>http://jena.apache.org/documentation/query/text-query.html#building-a-text
>-index
>
>
>On Thu, Aug 8, 2013 at 3:45 PM, Rob Vesse <rv...@yarcdata.com> wrote:
>
>> What are you trying to achieve?
>>
>> tdbloader/tdbloader2 are for bulk loading data into a TDB store
>>
>> If you want to access that store you can write Java code to do so or you
>> can expose it as a server using Jena Fuseki.
>>
>> Rob
>>
>>
>>
>> On 8/8/13 12:33 PM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>>
>> >I am trying to use tdbloader2 on mac os 10.8.4 from command line. I
>>have
>> >all my triples successfully loaded into a tdb stored in directory
>>"tdb." I
>> >am sure it is successfully loaded because I can run any query on it
>> >successfully. So I try:
>> >
>> >apache-jena-2.10.1/bin/tdbloader2
>> >--loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
>> >NetBeansProjects/mdrolder/trunk/tdb
>> >
>> >And I get Exception in thread "main"
>>org.apache.jena.atlas.AtlasException:
>> >java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is
>>a
>> >directory).
>> >Which makes sense, I just do not understand how I am supposed to load
>>the
>> >tdb though. Should I just use one of the files within the TDB?
>> >
>> >Thanks,
>> >Brad
>>
>>
Re: tdbloader2 problem
Posted by Brad Moran <bm...@pinnacle21.net>.
I am trying to create a jena text search. So first I have to load the TDB
store I have created. Like this:
http://jena.apache.org/documentation/query/text-query.html#building-a-text-index
On Thu, Aug 8, 2013 at 3:45 PM, Rob Vesse <rv...@yarcdata.com> wrote:
> What are you trying to achieve?
>
> tdbloader/tdbloader2 are for bulk loading data into a TDB store
>
> If you want to access that store you can write Java code to do so or you
> can expose it as a server using Jena Fuseki.
>
> Rob
>
>
>
> On 8/8/13 12:33 PM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>
> >I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
> >all my triples successfully loaded into a tdb stored in directory "tdb." I
> >am sure it is successfully loaded because I can run any query on it
> >successfully. So I try:
> >
> >apache-jena-2.10.1/bin/tdbloader2
> >--loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
> >NetBeansProjects/mdrolder/trunk/tdb
> >
> >And I get Exception in thread "main" org.apache.jena.atlas.AtlasException:
> >java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is a
> >directory).
> >Which makes sense, I just do not understand how I am supposed to load the
> >tdb though. Should I just use one of the files within the TDB?
> >
> >Thanks,
> >Brad
>
>
Re: tdbloader2 problem
Posted by Rob Vesse <rv...@yarcdata.com>.
What are you trying to achieve?
tdbloader/tdbloader2 are for bulk loading data into a TDB store
If you want to access that store you can write Java code to do so or you
can expose it as a server using Jena Fuseki.
Rob
On 8/8/13 12:33 PM, "Brad Moran" <bm...@pinnacle21.net> wrote:
>I am trying to use tdbloader2 on mac os 10.8.4 from command line. I have
>all my triples successfully loaded into a tdb stored in directory "tdb." I
>am sure it is successfully loaded because I can run any query on it
>successfully. So I try:
>
>apache-jena-2.10.1/bin/tdbloader2
>--loc=NetBeansProjects/mdrolder/trunk/luceneIndexes
>NetBeansProjects/mdrolder/trunk/tdb
>
>And I get Exception in thread "main" org.apache.jena.atlas.AtlasException:
>java.io.FileNotFoundException: NetBeansProjects/mdrolder/trunk/tdb (Is a
>directory).
>Which makes sense, I just do not understand how I am supposed to load the
>tdb though. Should I just use one of the files within the TDB?
>
>Thanks,
>Brad