Great! Many thanks, Geert! Ghislain
> Le 20 mars 2017 à 06:44, Geert Josten <[email protected]> a écrit : > > Hi Ghislain, > > In you original mail, you wrote you used: >> curl --anyauth -u user:password -H "Content-type: application/sparql-query" >> -H "Accept: application/sparql-results+xml" --data-binary '@./q1.rq' >> http://localhost:8000/v1/graphs/sparql >> <http://localhost:8000/v1/graphs/sparql> > To target a specific database you could write: >> curl --anyauth -u user:password -H "Content-type: application/sparql-query" >> -H "Accept: application/sparql-results+xml" --data-binary '@./q1.rq' >> http://localhost:8000/v1/graphs/sparql >> <http://localhost:8000/v1/graphs/sparql>?database=myExistingDB > > To target a different rest-api: >> curl --anyauth -u user:password -H "Content-type: application/sparql-query" >> -H "Accept: application/sparql-results+xml" --data-binary '@./q1.rq' >> http://localhost:8020/v1/graphs/sparql >> <http://localhost:8000/v1/graphs/sparql> > Kind regards, > Geert > > From: <[email protected] > <mailto:[email protected]>> on behalf of Ghislain > Atemezing <[email protected] > <mailto:[email protected]>> > Reply-To: MarkLogic Developer Discussion <[email protected] > <mailto:[email protected]>> > Date: Sunday, March 19, 2017 at 8:04 PM > To: MarkLogic Developer Discussion <[email protected] > <mailto:[email protected]>> > Subject: Re: [MarkLogic Dev General] Error 500 when queryinq with Curl > > Hi Geert, > Many thanks for your input. I don’t understand well the first approach. Could > you tell me how I can add the database to query in my Curl example? > Also, I’ve tried to follow the second recommendation. See below the steps. > [ > $ cat config.xml > <rest-api xmlns="http://marklogic.com/rest-api > <http://marklogic.com/rest-api>"> > <name>MyREST</name> > <database>myExistingDB</database> > <port>8020</port> > </rest-api> > > # curl to create > > $ curl -X POST --anyauth --user user:pwd -d @"./config.xml" \ > -H "Content-type: application/xml" \ > http://localhost:8002/LATEST/rest-apis > <http://localhost:8002/LATEST/rest-apis> After creating the rest-api in a > different > t port, using the existing database, I still get the same error. > ] > > Could you please tell me more details on how to solve this issue? > I really need it to make some analysis on users queries. > > TIA. > Best, > Ghislain > >> Le 17 mars 2017 à 19:43, Geert Josten <[email protected] >> <mailto:[email protected]>> a écrit : >> >> Hi Ghislain, >> >> You probably want to add a database parameter, pointing to the content >> database you’d like to query. Or use a rest-api instance linked to that >> content database directly, running on a different port. App-services (which >> runs on 8000) is linked to the Documents database, which out of the box does >> not have triple index enabled. >> >> Kind regards, >> Geert >> >> From: <[email protected] >> <mailto:[email protected]>> on behalf of Ghislain >> Atemezing-Pro <[email protected] >> <mailto:[email protected]>> >> Reply-To: MarkLogic Developer Discussion <[email protected] >> <mailto:[email protected]>> >> Date: Friday, March 17, 2017 at 6:39 PM >> To: MarkLogic Developer Discussion <[email protected] >> <mailto:[email protected]>> >> Subject: [MarkLogic Dev General] Error 500 when queryinq with Curl >> >> Hi all? >> >> I am trying to run a SPARQL query using Curl in my endpoint. >> I am doing the following: >> >> curl --anyauth -u user:password -H "Content-type: application/sparql-query" >> -H "Accept: application/sparql-results+xml" --data-binary '@./q1.rq' >> http://localhost:8000/v1/graphs/sparql >> <http://localhost:8000/v1/graphs/sparql> >> >> But I receive back a 500 errors as described below: >> >> <error-response xmlns="http://marklogic.com/xdmp/error >> <http://marklogic.com/xdmp/error>"> >> <status-code>500</status-code> >> <status>Internal Server Error</status> >> <message-code>INTERNAL ERROR</message-code> >> <message>XDMP-TRPLIDXNOTFOUND: >> xdmp:security-assert("http://marklogic.com/xdmp/privileges/rest-reader >> <http://marklogic.com/xdmp/privileges/rest-reader>", "execute"), let $rule >> := conf:get-sparql-protocol-rule() let $params := >> rest:process-request($rule) let $headers := eput:get-request-headers() let >> $method := eput:get-request-method($headers) let $env := map:map() let >> $params := local:validate-params($rule, $env, $params) let $body := switch >> ($method) case "GET" return text { fn:head((map:get($params, "query"), >> map:get($params, "update"))) } case "POST" return >> xdmp:get-request-body(eput:get-content-format($headers, $params))/node() >> default return fn:error((), "REST-UNSUPPORTEDMETHOD", $method) let $result >> := semmod:sparql-query($headers, $params, $body) let $response := if >> ($result instance of xs:string and $result = ("EMPTY-CONSTRUCT", >> "EMPTY-DESCRIBE")) then semmod:empty-construct($headers, $params, >> local:sparql-callback#2) else if ($result instance of xs:string and $result >> eq "EMPTY-SELECT") then semmod:empty-select($headers, $params, >> local:sparql-callback#2) else semmod:results-payload($headers, $params, >> $result, local:sparql-callback#2) return if ($response instance of node() >> and $response/self::semmod:malformed-query) then >> (xdmp:set-response-code(400, "Malformed Query"), $response) else $response >> -- Triple index not enabled . See the MarkLogic server error log for further >> detail.</message> >> </error-response> >> >> The same query works just fine in the qconsole interface. >> What Am I missing here? >> >> Thanks for any help or pointer. >> Best, >> >> Ghislain >> -- >> -------------------------------------------- >> Ghislain A. Atemezing, Ph.D >> R&D Engineer >> @ Mondeca, Paris, France >> Labs: http://labs.mondeca.com <http://labs.mondeca.com/> >> Tel: +33 (0)1 4111 3034 >> Web: www.mondeca.com <http://www.mondeca.com/> >> Twitter: @gatemezing >> About Me: http://atemezing.org <http://atemezing.org/> >> >> _______________________________________________ >> General mailing list >> [email protected] <mailto:[email protected]> >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general >> <http://developer.marklogic.com/mailman/listinfo/general> > > -------------------------------------------- > Ghislain A. Atemezing, Ph.D > R&D Engineer SemWeb > @ Mondeca, Paris, France > Labs: http://labs.mondeca.com <http://labs.mondeca.com/> > Tel: +33 (0)1 4111 3034 > Web: www.mondeca.com <http://www.mondeca.com/> > Twitter: @gatemezing > About Me: https://w3id.org/people/gatemezing > <https://w3id.org/people/gatemezing> > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general -------------------------------------------- Ghislain A. Atemezing, Ph.D R&D Engineer SemWeb @ Mondeca, Paris, France Labs: http://labs.mondeca.com <http://labs.mondeca.com/> Tel: +33 (0)1 4111 3034 Web: www.mondeca.com <http://www.mondeca.com/> Twitter: @gatemezing About Me: https://w3id.org/people/gatemezing <https://w3id.org/people/gatemezing>
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
