Comments (13)
thanks for the clarification.
yes, I will check how I can add them to headers!
from ld-r.
@mathib looks nice! thanks for sharing. I will have a look to see how their SPARQl API works. Should be quite straightforward .
from ld-r.
Great! Finally an easy way to share an LD-R app with some demo triples :)
from ld-r.
Great! Finally an easy way to share an LD-R app with some demo triples :)
yes! I added support for GraphDB there...
from ld-r.
Did some quick tests:
- graph db on localhost: works (read+edit)
in the default server.js config, there's a missing parametergraphName
. TheuseReasoning
function doesn't do anything (graphdb defaults to true) - graph db on cloud version: only reading works for me...
used settings in server.js config:
host: 'rdf.ontotext.com', port: 80, path: '/<DB-number>/<DB-id>/repositories/<repo-id>', graphName: 'default', endpointType: 'graphdb'
When I try to edit something, I get the following:
name: 'RequestError',
message: 'Error: read ECONNRESET',
cause: { Error: read ECONNRESET
at TCP.onread (net.js:602:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
error: { Error: read ECONNRESET
at TCP.onread (net.js:602:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
options:
{ uri: 'http://rdf.ontotext.com:443/<DB-number>/<DB-id>/repositories/<repo-id>?format=application%2Fsparql-results%2Bjson&query=%0A%20%20%20%20%20%20%20%20PREFIX%20xsd%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20ldr%3A%20%3Chttps%3A%2F%2Fgithub.com%2Fali1k%2Fld-reactor%2Fblob%2Fmaster%2Fvocabulary%2Findex.ttl%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20owl%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20dcterms%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0A%20%20%20%20%20%20%20%20PREFIX%20void%3A%20%3Chttp%3A%2F%2Frdfs.org%2Fns%2Fvoid%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0A%20%20%20%20%20%20%20%20PREFIX%20skos%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0A%20%20%20%20%20%20%20%20PREFIX%20DBpedia%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2F%3E%0A%20%20%20%20%20%20%20%20PREFIX%20Schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20SELECT%20%3Fp%20%3Fo%20%28count%28DISTINCT%20%3FextendedVal%29%20AS%20%3FhasExtendedValue%29%20%28SAMPLE%28%3Folb%29%20AS%20%3FoLabel%29%20%28SAMPLE%28%3Fotb%29%20AS%20%3FoTitle%29%20WHERE%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chttps%3A%2F%2Fwww.ugent.be%2FmyAwesomeFirstBIMProject%23site_7b7032cc-b822-417b-9aea-642906a29bd7%3E%20%3Fp%20%3Fo%20.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%3Fo%20%3Furi%20%3FextendedVal%20.%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%3Fo%20rdfs%3Alabel%20%3Fol%20.%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%3Fo%20dcterms%3Atitle%20%3Fot%20.%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20BIND%20%28%20IF%20%28BOUND%20%28%3Fol%29%2C%20%3Fol%2C%20%27%27%20%29%20%20as%20%3Folb%20%20%29%20.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20BIND%20%28%20IF%20%28BOUND%20%28%3Fot%29%2C%20%3Fot%2C%20%27%27%20%29%20%20as%20%3Fotb%20%20%29%20.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20GROUP%20BY%20%3Fp%20%3Fo%0A%20%20%20%20%20%20%20%20',
headers: { Accept: 'application/sparql-results+json' },
method: 'GET',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }
I tried with port 443 as it graphdb cloud is served on https, but then I get the following error:
{ RequestError: Error: read ECONNRESET
at new RequestError (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request-promise-core\lib\errors.js:14:15)
at Request.plumbing.callback (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request-promise-core\lib\plumbing.js:87:29)
at Request.RP$callback [as _callback] (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request-promise-core\lib\plumbing.js:46:31)
at self.callback (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request\request.js:185:22)
at Request.emit (events.js:180:13)
at Request.onRequestError (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request\request.js:881:8)
at ClientRequest.emit (events.js:185:15)
at Socket.socketErrorListener (_http_client.js:395:9)
at Socket.emit (events.js:180:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at process._tickCallback (internal/process/next_tick.js:178:19)
From previous event:
at Request.plumbing.init (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request-promise-core\lib\plumbing.js:36:28)
at Request.RP$initInterceptor [as init] (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request-promise-core\configure\request2.js:41:27)
at new Request (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request\request.js:127:8)
at request (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request\index.js:53:10)
at Function.post (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\request\index.js:61:12)
at C:/Users/<USER-NAME>/Desktop/ld-r/services/facet.js:280:24
at C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/Configurator.js:61:13
at DynamicConfigurator.prepareDynamicDatasetConfig (C:/Users/<USER-NAME>/Desktop/ld-r/plugins/dynamicConfiguration/DynamicConfigurator.js:479:13)
at Configurator.prepareDatasetConfig (C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/Configurator.js:47:29)
at C:/Users/<USER-NAME>/Desktop/ld-r/services/facet.js:237:30
at C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/dynamicHelpers.js:72:13
at C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/dynamicHelpers.js:49:9
at DynamicConfigurator.prepareDynamicServerConfig (C:/Users/<USER-NAME>/Desktop/ld-r/plugins/dynamicConfiguration/DynamicConfigurator.js:172:13)
at prepareDGFunc (C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/dynamicHelpers.js:15:25)
at getDynamicEndpointParameters (C:/Users/<USER-NAME>/Desktop/ld-r/services/utils/dynamicHelpers.js:54:9)
at Object.read (C:/Users/<USER-NAME>/Desktop/ld-r/services/facet.js:234:13)
at Immediate.executeRequest (C:\Users\<USER-NAME>\Desktop\ld-r\node_modules\fetchr\libs\fetcher.js:229:21)
at runCallback (timers.js:764:11)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
name: 'RequestError',
message: 'Error: read ECONNRESET',
cause: { Error: read ECONNRESET
at TCP.onread (net.js:602:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
error: { Error: read ECONNRESET
at TCP.onread (net.js:602:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
options:
{ uri: 'http://rdf.ontotext.com:443/<DB-number>/<DB-id>/repositories/<repo-id>',
form:
{ query: '\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n PREFIX dcterms: <http://purl.org/dc/terms/>\n PREFIX void: <http://rdfs.org/ns/void#>\n PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\n \n SELECT (count(DISTINCT ?s) AS ?total) WHERE {\n \n ?s rdf:type ?type . FILTER (?type IN (<https://w3id.org/bot#Site>,<https://w3id.org/bot#Building>,<https://w3id.org/bot#Storey>,<https://w3id.org/bot#Space>,<https://w3id.org/bot#Element>)) \n \n \n }\n ',
format: 'application/sparql-results+json' },
headers: { Accept: 'application/sparql-results+json' },
timeout: 10000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }
from ld-r.
it probably has something to do with authentication?
from ld-r.
Some documentation that might come in handy:
- http://cloud-docs.ontotext.com/display/S4docs/NodeJS
- http://cloud-docs.ontotext.com/display/S4docs/GraphDB+Cloud+REST+APIs
from ld-r.
@ali1k I've also did some testing with Postman to the graphdb cloud database and I've found out that I need indeed authentication to the SPARQL endpoint for this. I've also found that the request has to be modified in the case of SPARQL update:
- POST request instead of GET
- basic authentication (username/pw)
- endpoint changes from:
host: 'rdf.ontotext.com', port: 80, path: '/<DB-number>/<DB-id>/repositories/<repo-id>
in the case of reading the db into:
host: 'rdf.ontotext.com', port: 80, path: '/<DB-number>/<DB-id>/repositories/<repo-id>/statements'
when updating the db - header parameter changes from
query
in the case of reading, intoupdate
when updating
Did you by any chance had some time to look into authentication-based access to SPARQL endpoints as mentioned here? If so, is there any documentation on how to use it? Thanks :)
from ld-r.
thanks for the comments. I have already added those changes for GraphDB:
https://github.com/ali1k/ld-r/blob/master/services/utils/helpers.js#L168-L177
you can use username
and password
attributes in your server.js file for HTTP-based authentication. Let me know if it works with that
from ld-r.
Hi! Great, this works for me :) Think you can then close issue 18? Or does it need more testing on other kind of triplestores with authentication?
I'm no expert in this, but isn't it safer to add username
and password
as basic auth in the header, instead of adding it to the URL? I've also noted that the attribute reasoning
has to be changed to infer
in the case of graphdb
from ld-r.
great! I closed the issue #18
I don't think these credentials will be shared anywhere on the client as they are only shared on the server side of LD-R. However, it is still worth to further investigate that.
I also added support for infer
when add useReasoning
flag in server config.
from ld-r.
I don't think these credentials will be shared anywhere on the client as they are only shared on the server side of LD-R
No, I meant that if you add credentials to the URL of the request, it is just plain and open (I think), while if you add it as an attribute in the header it is hashed?
I also added support for infer when add useReasoning flag in server config.
Thanks!
from ld-r.
Hi,
I try to configure ld-r but although I indicate graphDB in my config file, I still have ClioPatria in my ldr repository (graphDB) ... I think I got rid of all mention of ClioPatria in the config files.
from ld-r.
Related Issues (20)
- deploy on Heroku HOT 1
- Pb with GraphDB HOT 18
- Nesting property categories HOT 1
- Support property chains in reactor.js HOT 9
- Weird Behaviour HOT 2
- working with jena/fuseki HOT 1
- Wrong propertyURI creation while creating the "facets" HOT 1
- SPARQL Editor
- Question on setting base URI when creating a new resource HOT 5
- No users displayed in admin user list HOT 4
- dealing with reading/writing to named graphs and the default graph in GraphDB HOT 3
- Workflow for managing user permissions HOT 1
- property set to isHidden is still visible in detailed view
- blank nodes cannot be viewed as subjects HOT 2
- Default edit access for users HOT 1
- Support JWT to authenticate against GraphDB HOT 1
- Multi Resource Reactor HOT 13
- Debugging HOT 2
- reference to the sparql endpoint for a dataset (Dynamic Configuration) HOT 2
- Label rendering behavior
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ld-r.