Hi Andy,

- Fuseki started via "fuseki-server".
- shiro config attached
- "pdm-data-model" dataset created via attached config
- Simple test app attached which takes the fuseki dataset url as
  parameter.

Hope this helps.

Regards,
Sebastian

On 31.10.19 11:55, Andy Seaborne wrote:
> Sebastian,
> 
> Do you have a complete, minimal example, including the Fuseki setup for
> the user/password. Which Fuseki variant? war? full-jar? main?
> 
>     Andy
> 
> PS Don't forget teh javadoc on connectPW : it's "basic auth"
> 
> On 31/10/2019 10:30, Sebastian Trueg wrote:
>> Hi everyone,
>>
>> trying to use RDFConnection with Jena 3.13.1 to put a Model into a
>> remote Fuseki instance I encountered very strange behavior. First off,
>> let me show my very simple code:
>>
>> try(RDFConnection conn
>>     = RDFConnectionFactory.connectPW(datasetUrl, "admin", "admin")) {
>>     conn.put(graphUri, model);
>> }
>>
>> This works fine on its own and for very small models in general. But as
>> soon as I repeat the exact same snippet of code, ie. run the same try
>> block twice I get a SocketException (Broken pipe) on the first call to
>> RDFConnection::put.
>>
>> So, to sum up:
>> - Single put works fine.
>> - A subsequent call to put will result in the first one already throwing
>>    an exception!
>> - Using a model with less than 100 triples results in both put
>>    operations to succeed.
>> - In all this the Fuseki instance keeps on working.
>>
>> Any ideas?
>>
>> Regards,
>> Sebastian
>>

-- 
Sebastian Trueg
Managing Director
TrueGeeX UG (haftungsbeschränkt)
[email protected]
http://www.linkedin.com/in/trueg
Mobile: 0049 1762 3244 664

Attachment: shiro.ini
Description: application/wine-extension-ini

######## Example of a TDB dataset and text index#########################
# The main doc sources are:
#  - https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html
#  - https://jena.apache.org/documentation/assembler/assembler-howto.html
#  - https://jena.apache.org/documentation/assembler/assembler.ttl
# See https://jena.apache.org/documentation/fuseki2/fuseki-layout.html for the destination of this file.
#########################################################################

@prefix :        <http://localhost/jena_example/#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
@prefix text:    <http://jena.apache.org/text#> .
@prefix skos:    <http://www.w3.org/2004/02/skos/core#>
@prefix fuseki:  <http://jena.apache.org/fuseki#> .

[] rdf:type fuseki:Server ;
   fuseki:services (
     :pdmDataModelService
   ) .

:pdmDataModelService rdf:type fuseki:Service ;
    fuseki:name                       "pdm-data-model" ;
    fuseki:serviceQuery               "query" , "sparql" ;
    fuseki:serviceUpdate              "update" ;
    fuseki:serviceUpload              "upload" ;
    fuseki:serviceReadWriteGraphStore "data" ;
    fuseki:serviceReadGraphStore      "get" ;
    fuseki:dataset                    :pdmDataModelTextDs .

## ---------------------------------------------------------------

# A TextDataset is a regular dataset with a text index.
:pdmDataModelTextDs rdf:type     text:TextDataset ;
    text:dataset   :pdmDataModelDs ;
    text:index     :pdmDataModelIndexLucene .

# A TDB dataset used for RDF storage
:pdmDataModelDs rdf:type      tdb:DatasetTDB ;
    tdb:location "/tmp/fuseki-test/databases/datamodel" ;
    tdb:unionDefaultGraph true .

# Text index description
:pdmDataModelIndexLucene a text:TextIndexLucene ;
    text:directory <file://tmp/fuseki-test/databases/datamodel-idx> ;
    text:entityMap :pdmDataModelIndexEntMap ;
    text:storeValues true ;
    text:analyzer [ a text:StandardAnalyzer ] ;
    text:queryAnalyzer [ a text:KeywordAnalyzer ] ;
    text:queryParser text:AnalyzingQueryParser ;
    text:multilingualSupport true .

# Entity map (see documentation for other options)
:pdmDataModelIndexEntMap a text:EntityMap ;
    text:defaultField     "text" ;
    text:entityField      "uri" ;
    text:uidField         "uid" ;
    text:langField        "lang" ;
    text:graphField       "graph" ;
    text:map (
        [ text:field "text" ;
          text:predicate rdfs:label ]
        [ text:field "text" ;
          text:predicate rdfs:comment ]
    ) .
package test;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdfconnection.RDFConnection;
import org.apache.jena.rdfconnection.RDFConnectionFactory;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;

import java.io.IOException;

public class PlanningIt2Rdf {
    public static void main(String[] args) throws IOException {
        Model model = ModelFactory.createDefaultModel();
        for (int i = 0; i < 100; ++i) {
            model.add(model.createResource("urn:test:res" + i), RDF.type, model.createResource("urn:test:thing"));
            model.add(model.createResource("urn:test:res" + i), RDFS.label, model.createLiteral("Thing " + i, "en"));
            model.add(model.createResource("urn:test:subres" + i), RDF.type, model.createResource("urn:test:thing"));
            model.add(model.createResource("urn:test:subres" + i), RDFS.label, model.createLiteral("Subthing " + i, "en"));
            model.add(model.createResource("urn:test:res" + i), model.createProperty("urn:test:hasSubThing"), model.createResource("urn:test:subres" + i));
        }

        try(RDFConnection conn = RDFConnectionFactory.connectPW(args[0], "admin", "admin")) {
            conn.put("urn:graphs:test", model);
        }

        try(RDFConnection conn = RDFConnectionFactory.connectPW(args[0], "admin", "admin")) {
            conn.put("urn:graphs:test", model);
        }
    }
}

Reply via email to