OWL via Sesame SPARQLRepository

1 view
Skip to first unread message

fal...@gmail.com

unread,
Apr 13, 2014, 5:24:43 AM4/13/14
to sta...@clarkparsia.com
Hi,

I'm using Stardog Community Edition 2.1.2, Sesame 2.7.11 and ran into following problem:
If I try to add an owl file (in xml/rdf format) I get an HTTP status code 415 as answer, but if I upload the very same file via the WebGUI -> Data -> Add no error occurs.
I've used mitmproxy in reverse proxy mode to get the HTTP status code, but I assume using the proxy doesn't add additional problems, because the exception stays the same whether I use the proxy.

Can you give me some hints on what I'm doing wrong?!

Thanks and kind regards,
Alexander Falb

------------------------------------

This is the Java code:
SPARQLRepository repository = new SPARQLRepository("http://localhost:8080/benchmark");
repository
.setUsernameAndPassword("admin", "admin");
repository
.initialize();

RepositoryConnection repositoryConnection = repository.getConnection();
repositoryConnection
.begin();
repositoryConnection
.add(new File("eplan_empty.owl"), "", RDFFormat.RDFXML);
repositoryConnection
.commit();

repository
.shutDown();


The exception I get - where line 19 is the "repositoryConnection.commit()"
[main] WARN  org.openrdf.http.client.HTTPClient:1011 - Server reports problem: 
Exception in thread "main" org.openrdf.repository.RepositoryException: error executing transaction
at org.openrdf.repository.sparql.SPARQLConnection.commit(SPARQLConnection.java:300)
at at.ac.tuwien.otpb.AnotherTestMain.main(AnotherTestMain.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.openrdf.query.UpdateExecutionException: 
at org.openrdf.repository.sparql.query.SPARQLUpdate.execute(SPARQLUpdate.java:78)
at org.openrdf.repository.sparql.SPARQLConnection.commit(SPARQLConnection.java:297)
... 6 more
Caused by: org.openrdf.repository.RepositoryException: 
at org.openrdf.http.client.HTTPClient.handleHTTPError(HTTPClient.java:953)
at org.openrdf.http.client.HTTPClient.sendUpdate(HTTPClient.java:390)
at org.openrdf.repository.sparql.query.SPARQLUpdate.execute(SPARQLUpdate.java:61)
... 7 more

And the owl file:
<?xml version="1.0"?>
<rdf:RDF
   
xmlns="http://www.owl-ontologies.com/Ontology1370788248.owl#"
   
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   
xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
   
xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
   
xmlns:owl="http://www.w3.org/2002/07/owl#"
   
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
   
xmlns:swrl="http://www.w3.org/2003/11/swrl#"
   
xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
   
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 
xml:base="http://www.owl-ontologies.com/Ontology1370788248.owl">
 
<owl:Ontology rdf:about=""/>
 
<owl:Class rdf:ID="EPLAN_Signal"/>
 
<owl:DatatypeProperty rdf:ID="signalNumber">
   
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
   
<rdfs:domain rdf:resource="#EPLAN_Signal"/>
 
</owl:DatatypeProperty>
 
<owl:DatatypeProperty rdf:ID="plcAddress">
   
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
   
<rdfs:domain rdf:resource="#EPLAN_Signal"/>
 
</owl:DatatypeProperty>
 
<owl:DatatypeProperty rdf:ID="dataType">
   
<rdfs:domain rdf:resource="#EPLAN_Signal"/>
   
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
 
</owl:DatatypeProperty>
 
<owl:DatatypeProperty rdf:ID="functionText">
   
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
   
<rdfs:domain rdf:resource="#EPLAN_Signal"/>
 
</owl:DatatypeProperty>
 
<owl:DatatypeProperty rdf:ID="symbolicAddress">
   
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
   
<rdfs:domain rdf:resource="#EPLAN_Signal"/>
 
</owl:DatatypeProperty>
</rdf:RDF>

<!-- Created with Protege (with OWL Plugin 3.4.8, Build 629)  http://protege.stanford.edu -->

Evren Sirin

unread,
Apr 16, 2014, 3:41:19 PM4/16/14
to Stardog
SPARQLRepository uses SPARQL Update queries to commit changes so it
should use the SPARQL query endpoint:
"http://localhost:8080/benchmark/query". The URL
"http://localhost:8080/benchmark" would be used for SPARQL graph store
protocol [1] which is different.

Best,
Evren

[1] http://www.w3.org/TR/sparql11-http-rdf-update/
> --
> -- --
> You received this message because you are subscribed to the C&P "Stardog"
> group.
> To post to this group, send email to sta...@clarkparsia.com
> To unsubscribe from this group, send email to
> stardog+u...@clarkparsia.com
> For more options, visit this group at
> http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

fal...@gmail.com

unread,
Apr 16, 2014, 11:53:06 PM4/16/14
to sta...@clarkparsia.com
Thanks for pointing me in the right direction - it's working now!

Kind regards,
Alex
Reply all
Reply to author
Forward
0 new messages