Re: Append existing graph runtime

2017-09-26 Thread Dimov, Stefan
It’s one machine, one Fuseki and one TDB. Nothing shared, no separate processes 
…

S.

On 9/26/17, 1:50 AM, "Andy Seaborne"  wrote:



On 26/09/17 02:04, Dimov, Stefan wrote:
> Hello,
> 
> I have a Fuseki/Jena setup and while it’s running, I’m trying to update 
one of the existing graph with more triples. I’m using the code:
> 
> ds.begin(ReadWrite.WRITE);
> Model model = ds.getNamedModel(graphName);
> FileManager.get().readModel(model, sourceFileName);
> ds.commit();
> ds.end();

Is this code running inside Fuseki or in a separate process?

If in a separate process, updating the files of TDB directly is not 
supported.

If you are doing that and that code executes at all, is it in a 
different machine to the Fusekis server? Shared files in someway?

(see email 22/Sept)

> 
> The operation finishes without error, but as a result in TDB I have two 
graphs with the name graphName, instead of having the initially existing graph 
appended?

RDFConnection.put(filename);

> 
> Seems like a bug in Jena. How can workaround it? Or am I doing something 
wrong?
> 
> Regards,
> Stefan
> 




Retrieve list of entities

2017-09-26 Thread Laura Morales
Let's say I have 2 graphs loaded in my Fuseki, and one graph is linked to the 
other via a "http://schema.org/sameAs; relation.
How can I retrieve all nodes in the "default" graph (= the union of the two 
graphs), such that all relations " schema:sameAs " are treated as 
a single node, and therefore returned only once?
Can I do this with Jena/Fuseki or do I have to create a new graph by myself?


Re: Missing solution in SPARQL select result, however this solution exists in the dataset

2017-09-26 Thread Andy Seaborne



On 26/09/17 17:00, Laurent Rucquoy wrote:

- Did you reload the data ?
No, I did not know that. How can I reload the data ?


Write out with tdbdump from Jena 2.10.1 and load into a clean database 
with tdbloader from 3.1.1


https://jena.apache.org/documentation/migrate_jena2_jena3.html#persistent-data



- We are using the Apache Jena 3.1.1 instead of 3.4.0 because this is
integrated in a product with a big release cycle...

- Is there a transaction ?
Yes all the queries are made in transactions





- Here is a minimal example

String sparql = "SELECT ?annotationDimension WHERE {
 <
http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-bb71-2d416f729db8-msr>
 ?annotationDimension .
}";

Dataset dataset = TDBFactory.createDataset("C:/tdb");
dataset.begin(ReadWrite.READ);





try {

 try (QueryExecution queryExecution =
QueryExecutionFactory.create(sparql, dataset)) {


Not what you had last time!



 ResultSet resultSet = queryExecution.execSelect();

 while (resultSet.hasNext()) {  // <=== No result

 QuerySolution querySolution = resultSet.nextSolution();
 RDFNode rdfNode = querySolution.get("annotationDimension");
 if(rdfNode != null) {
 if(rdfNode.isLiteral()) {
  // ...
 } else if(rdfNode.isResource()) {
 // ...
 }
 }
 }
 }

} finally {
 dataset.end();
}


- Do you need a larger data sample ?


There isn't any data sample here!


If you have some small amount of data, a test query, I might be able to 
run it otherwise you can test reloaded data with tdbquery using your 
queries.


Andy




Thank you for your help.

Laurent




On 26 September 2017 at 16:40, Andy Seaborne  wrote:


Did you reload the data?

https://jena.apache.org/documentation/migrate_jena2_jena3.html



On 26/09/17 15:08, Laurent Rucquoy wrote:


Hello,

We are currently migrating an Apache Jena 2.10.1 (jena-tdb 0.10.1) dataset
to a new model with Apache Jena 3.1.1



3.1.1 is old - 3.4.0 is current.



Some SPARQL select queries on the source dataset don't return any solution
when the where pattern includes a triple having a resource as object
(others patterns have a literal as object)... however we are sure that the
missing solution exists.

Here is an example of query where ?annotationDimension is a resource:

SELECT ?annotationDimension
WHERE {
  <
http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-
bb71-2d416f729db8-msr>
 ?annotationDimension .
}

These queries are executed through



Is there a transaction?

QueryExecution queryExecution = QueryExecutionFactory.create(sparql,

dataset, initialJenaQuerySolutionMap)


^^^

ResultSet resultSet = queryExecution.execSelect();



What can I do to retrieve the missing solution ?

Thank you in advance for your help.



Please provide a complete, minimal example.  As described, I can't
recreate a test case because it is about the data.

 Andy



Regards,
Laurent






Re: Missing solution in SPARQL select result, however this solution exists in the dataset

2017-09-26 Thread Laurent Rucquoy
- Did you reload the data ?
No, I did not know that. How can I reload the data ?

- We are using the Apache Jena 3.1.1 instead of 3.4.0 because this is
integrated in a product with a big release cycle...

- Is there a transaction ?
Yes all the queries are made in transactions


- Here is a minimal example

String sparql = "SELECT ?annotationDimension WHERE {
<
http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-bb71-2d416f729db8-msr>
 ?annotationDimension .
}";

Dataset dataset = TDBFactory.createDataset("C:/tdb");
dataset.begin(ReadWrite.READ);

try {

try (QueryExecution queryExecution =
QueryExecutionFactory.create(sparql, dataset)) {

ResultSet resultSet = queryExecution.execSelect();

while (resultSet.hasNext()) {  // <=== No result

QuerySolution querySolution = resultSet.nextSolution();
RDFNode rdfNode = querySolution.get("annotationDimension");
if(rdfNode != null) {
if(rdfNode.isLiteral()) {
 // ...
} else if(rdfNode.isResource()) {
// ...
}
}
}
}

} finally {
dataset.end();
}


- Do you need a larger data sample ?


Thank you for your help.

Laurent




On 26 September 2017 at 16:40, Andy Seaborne  wrote:

> Did you reload the data?
>
> https://jena.apache.org/documentation/migrate_jena2_jena3.html
>
>
>
> On 26/09/17 15:08, Laurent Rucquoy wrote:
>
>> Hello,
>>
>> We are currently migrating an Apache Jena 2.10.1 (jena-tdb 0.10.1) dataset
>> to a new model with Apache Jena 3.1.1
>>
>
> 3.1.1 is old - 3.4.0 is current.
>
>
>> Some SPARQL select queries on the source dataset don't return any solution
>> when the where pattern includes a triple having a resource as object
>> (others patterns have a literal as object)... however we are sure that the
>> missing solution exists.
>>
>> Here is an example of query where ?annotationDimension is a resource:
>>
>> SELECT ?annotationDimension
>> WHERE {
>>  <
>> http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-
>> bb71-2d416f729db8-msr>
>>  ?annotationDimension .
>> }
>>
>> These queries are executed through
>>
>>
> Is there a transaction?
>
> QueryExecution queryExecution = QueryExecutionFactory.create(sparql,
>> dataset, initialJenaQuerySolutionMap)
>>
>^^^
>
> ResultSet resultSet = queryExecution.execSelect();
>>
>>
>> What can I do to retrieve the missing solution ?
>>
>> Thank you in advance for your help.
>>
>
> Please provide a complete, minimal example.  As described, I can't
> recreate a test case because it is about the data.
>
> Andy
>
>
>> Regards,
>> Laurent
>>
>>


Re: Getting xml with s-get

2017-09-26 Thread Mikael Pesonen


Thanks! Missed the sentence The file name extension determines the HTTP 
content type.




On 26.9.2017 18:09, aj...@apache.org wrote:
Looks like it is trying to parse it as RDF/XML, which means that s-put 
is trying to send it as such.

Are you using an appropriate filename extension? See:

https://jena.apache.org/documentation/fuseki2/soh.html#soh-sparql-http

"file is needed for PUT and POST. The file name extension determines 
the HTTP content type."


ajs6f

Mikael Pesonen wrote on 9/26/17 11:04 AM:


Related to this, when trying to s-put triple data back to jena, which 
is gotten from s-get, I get


500 Parse error: [line: 1, col: 8 ] Element or attribute do not match 
QName production: QName::=(NCName':')?NCName.


First 4 rows:

 


    a  ;
    
    "lait" ;

Br,


On 25.9.2017 17:14, aj...@apache.org wrote:

According to:

https://github.com/apache/jena/blob/master/jena-fuseki2/apache-jena-fuseki/bin/s-get#L29 



that remains a TODO. Maybe file a ticket?

ajs6f

Mikael Pesonen wrote on 9/21/17 9:20 AM:


Sorry if this is documented somewhere but could not find info on 
how to change the output format of s-get command line tool.


Br,





--
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's 
Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.peso...@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND



Re: Getting xml with s-get

2017-09-26 Thread ajs6f

Looks like it is trying to parse it as RDF/XML, which means that s-put is 
trying to send it as such.
Are you using an appropriate filename extension? See:

https://jena.apache.org/documentation/fuseki2/soh.html#soh-sparql-http

"file is needed for PUT and POST. The file name extension determines the HTTP 
content type."

ajs6f

Mikael Pesonen wrote on 9/26/17 11:04 AM:


Related to this, when trying to s-put triple data back to jena, which is gotten 
from s-get, I get

500 Parse error: [line: 1, col: 8 ] Element or attribute do not match QName 
production: QName::=(NCName':')?NCName.

First 4 rows:


a    ;

"lait" ;

Br,


On 25.9.2017 17:14, aj...@apache.org wrote:

According to:

https://github.com/apache/jena/blob/master/jena-fuseki2/apache-jena-fuseki/bin/s-get#L29

that remains a TODO. Maybe file a ticket?

ajs6f

Mikael Pesonen wrote on 9/21/17 9:20 AM:


Sorry if this is documented somewhere but could not find info on how to change 
the output format of s-get command line tool.

Br,





Re: Getting xml with s-get

2017-09-26 Thread Mikael Pesonen


Related to this, when trying to s-put triple data back to jena, which is 
gotten from s-get, I get


500 Parse error: [line: 1, col: 8 ] Element or attribute do not match 
QName production: QName::=(NCName':')?NCName.


First 4 rows:


    a    ;
    
    "lait" ;

Br,


On 25.9.2017 17:14, aj...@apache.org wrote:

According to:

https://github.com/apache/jena/blob/master/jena-fuseki2/apache-jena-fuseki/bin/s-get#L29 



that remains a TODO. Maybe file a ticket?

ajs6f

Mikael Pesonen wrote on 9/21/17 9:20 AM:


Sorry if this is documented somewhere but could not find info on how 
to change the output format of s-get command line tool.


Br,



--
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's 
Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.peso...@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND



Re: Missing solution in SPARQL select result, however this solution exists in the dataset

2017-09-26 Thread Andy Seaborne

Did you reload the data?

https://jena.apache.org/documentation/migrate_jena2_jena3.html



On 26/09/17 15:08, Laurent Rucquoy wrote:

Hello,

We are currently migrating an Apache Jena 2.10.1 (jena-tdb 0.10.1) dataset
to a new model with Apache Jena 3.1.1


3.1.1 is old - 3.4.0 is current.



Some SPARQL select queries on the source dataset don't return any solution
when the where pattern includes a triple having a resource as object
(others patterns have a literal as object)... however we are sure that the
missing solution exists.

Here is an example of query where ?annotationDimension is a resource:

SELECT ?annotationDimension
WHERE {
 <
http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-bb71-2d416f729db8-msr>
 ?annotationDimension .
}

These queries are executed through



Is there a transaction?


QueryExecution queryExecution = QueryExecutionFactory.create(sparql,
dataset, initialJenaQuerySolutionMap)

   ^^^


ResultSet resultSet = queryExecution.execSelect();


What can I do to retrieve the missing solution ?

Thank you in advance for your help.


Please provide a complete, minimal example.  As described, I can't 
recreate a test case because it is about the data.


Andy



Regards,
Laurent



Missing solution in SPARQL select result, however this solution exists in the dataset

2017-09-26 Thread Laurent Rucquoy
Hello,

We are currently migrating an Apache Jena 2.10.1 (jena-tdb 0.10.1) dataset
to a new model with Apache Jena 3.1.1

Some SPARQL select queries on the source dataset don't return any solution
when the where pattern includes a triple having a resource as object
(others patterns have a literal as object)... however we are sure that the
missing solution exists.

Here is an example of query where ?annotationDimension is a resource:

SELECT ?annotationDimension
WHERE {
<
http://www.telemis.com/ImageAnnotation/000b3231-a9c3-42b1-bb71-2d416f729db8-msr>
 ?annotationDimension .
}

These queries are executed through

QueryExecution queryExecution = QueryExecutionFactory.create(sparql,
dataset, initialJenaQuerySolutionMap)
ResultSet resultSet = queryExecution.execSelect();


What can I do to retrieve the missing solution ?

Thank you in advance for your help.

Regards,
Laurent


Re: Append existing graph runtime

2017-09-26 Thread Andy Seaborne



On 26/09/17 02:04, Dimov, Stefan wrote:

Hello,

I have a Fuseki/Jena setup and while it’s running, I’m trying to update one of 
the existing graph with more triples. I’m using the code:

ds.begin(ReadWrite.WRITE);
Model model = ds.getNamedModel(graphName);
FileManager.get().readModel(model, sourceFileName);
ds.commit();
ds.end();


Is this code running inside Fuseki or in a separate process?

If in a separate process, updating the files of TDB directly is not 
supported.


If you are doing that and that code executes at all, is it in a 
different machine to the Fusekis server? Shared files in someway?


(see email 22/Sept)



The operation finishes without error, but as a result in TDB I have two graphs 
with the name graphName, instead of having the initially existing graph 
appended?


RDFConnection.put(filename);



Seems like a bug in Jena. How can workaround it? Or am I doing something wrong?

Regards,
Stefan