Hi Andy,

I've answered one question, but got another...

Your comment "What is more, I can't line the stacktrace line numbers up
with the code.  Jena 3.0.1 lines up better" made me sheepishly realise that
my tdbquery path was pointing to an old version of Jena I had locally
(although this was actually v3.3.0). I changed tdbquery to use v3.6.0 and
it worked! But, it struck me that I'd worked on some other code recently
where I'd compiled with 3.6.0 but tested with tdbquery 3.3.0 and hadn't
seen errors - so I did some basic tests.

I've found that reading in a URL directly into a model doesn't result in
this error; i.e. using my previous workflow but using this version of
jena_test.java


import org.apache.jena.query.Dataset;
import org.apache.jena.query.ReadWrite;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.tdb.TDBFactory;

public class jena_test {
public static void main(String args[])
{
Dataset dataset = TDBFactory.createDataset("my_dataset");
Model model = dataset.getDefaultModel();
dataset.begin(ReadWrite.WRITE);

try{
model.add(ModelFactory.createDefaultModel().read("
https://www.w3.org/TR/REC-rdf-syntax/example14.nt";, "N-TRIPLE"));
dataset.commit();
} finally {
dataset.close();
}
}
}


with the same pom version but tdbquery v3.3.0

C:\Users\chris\jena_test>tdbquery --version
Jena:       VERSION: 3.3.0
Jena:       BUILD_DATE: 2017-05-02T17:38:25+0000
ARQ:        VERSION: 3.3.0
ARQ:        BUILD_DATE: 2017-05-02T17:38:25+0000
RIOT:       VERSION: 3.3.0
RIOT:       BUILD_DATE: 2017-05-02T17:38:25+0000
TDB:        VERSION: 3.3.0
TDB:        BUILD_DATE: 2017-05-02T17:38:25+0000



results in

C:\Users\chris\jena_test >tdbquery --loc="my_dataset" "SELECT (count(*) as
?t) where {?a ?b ?c . }"
-----
| t |
=====
| 2 |
-----

As expected.

I recognise that using different versions of jena for compiling and for
tdbquery is almost certainly not supported (even if not implicitly), but
perhaps raising awareness from the troubles I've had this week might help
someone else!

Cheers
Chris





On 2 March 2018 at 13:38, Andy Seaborne <a...@apache.org> wrote:

> Hi Chris,
>
> I am on Linux, with Apache Maven 3.5.2, java openjdk version "1.8.0_151".
>
> It works for me.
>
> What is more, I can't line the stacktrace line numbers up with the code.
> Jena 3.0.1 lines up better on
>
> JournalControl.recoverSegment(JournalControl.java:185)
>
> because that is a call to "replay"
>
>
> I ran the maven compiled version with
>
>  java -cp target/classes:target/tdb_generator_resources/\* jena_test
>
> and then
>
> java -cp /home/afs/jlib/apache-jena-3.6.0/lib/\* tdb.tdbquery
> --loc=my_dataset 'SELECT (count(*) as ?t) where {?a ?b ?c . }'
>
> "tdbquery --version" ==>
>
> Jena:       VERSION: 3.7.0-SNAPSHOT
> Jena:       BUILD_DATE: 2018-02-27T22:54:52+0000
> ARQ:        VERSION: 3.7.0-SNAPSHOT
> ARQ:        BUILD_DATE: 2018-02-27T22:54:52+0000
> RIOT:       VERSION: 3.7.0-SNAPSHOT
> RIOT:       BUILD_DATE: 2018-02-27T22:54:52+0000
> TDB:        VERSION: ${project.version}
> TDB:        BUILD_DATE: ${build.time.xsd}
>
> (the TDB bit is old junk in 3.6.0 - ignore it)
>
> On 01/03/18 18:05, Chris Wood wrote:
>
>> java -jar .\target\jena_test.jar
>>
>
> The shade plugin wasn't configured to run, nor was it set to call the
> right main class.
>
> When I change the configuration, I also ran:
>
> java -jar target/jena_test.jar
>
> In all cases I got:
>
> -----
> | t |
> =====
> | 1 |
> -----
>
> So it's still a mystery to me, I'm afraid.
>
>         Andy
>
>   <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-shade-plugin</artifactId>
>     <version>3.1.0</version>
>     <executions>
>       <execution>
>         <phase>package</phase>
>         <goals>
>           <goal>shade</goal>
>         </goals>
>       </execution>
>     </executions>
>     <configuration>
>       <shadedArtifactAttached>false</shadedArtifactAttached>
>       <transformers>
>         <mainClass>jena_test</mainClass>
>
>         ....
>

Reply via email to