Comments (16)
from ml-lodlive.
@grtjn I thought ml-lodelive-ng uses dbpedia and not an internal ML endpoint.
from ml-lodlive.
It packages two pre-defined configs, one for dbpedia, one for marklogic..
from ml-lodlive.
but I guess it presumes that you're running on the same port? I have an app running on port 3000 trying to access ML on a different host.
from ml-lodlive.
The profile factory in ml-lodlive-ng gives you a plain json config. You can patch it with straight js. You could also just compare the ml profile with what you are currently using. Just to see where it differs from the one in this project or what you were using yourself..
from ml-lodlive.
Yes, this is the relevant bit:
MarkLogicProfile.connection = {
// http matches all http requests, so this will be the only connection settings used
'http:': {
endpoint: '/v1/graphs/sparql',
accepts: 'application/sparql-results+json',
description: {
en: 'MarkLogic LodLive'
}
}
};
This is what I have:
var MyProfileObject = {};
MyProfileObject.endpoints = {};
MyProfileObject.connection = {
'http:': {
endpoint: 'http://192.168.56.200:8060/lodlive.xqy',
accepts: 'application/sparql-results+json'
}
};
Since I'm not running my app from the same machine where ML is, according to the documentation I need this lodlive.xqy file:
"This can be loaded into MarkLogic as RDF triples and can the be exposed via a standard REST application in MarkLogic. If accessing this REST endpoint from a different host or port it will be necessary to install the lodlive.xqy module at the root of the /modules directory for that REST server. Additionally, update your lodlive profile so that the lodlive.xqy url is used as the base."
from ml-lodlive.
I of course also have this added to the config:
MyProfileObject.endpoints = {
all: '',
jsonp: true
};
from ml-lodlive.
I think the statement you need lodlive.xqy is wrong. Just prefix /v1/etc with host and port you need for you app..
from ml-lodlive.
I have done that. In that case the error changes to:
REST-UNSUPPORTEDPARAM: (err:FOER0000) Endpoint does not support query parameter: invalid parameters: _, callback for request
This is due to the fact that I am executing a JSONP request (because I am on different hosts)
from ml-lodlive.
Yeah, dont think v1 sparql supports jsonp. Can you live without that? 😁
from ml-lodlive.
Nope 😢 I need JSONP support. The problem is in the lodlive.xqy file somewhere ... but since XQY is not my strong suite I can't really figure it out. I have managed to update the code so that it no longer throws the error mentioned in the subject to be the following:
xquery version "1.0-ml";
import module namespace semmod = "http://marklogic.com/rest-api/models/semantics"
at "/MarkLogic/rest-api/models/semantics-model.xqy";
import module namespace eput = "http://marklogic.com/rest-api/lib/endpoint-util"
at "/MarkLogic/rest-api/lib/endpoint-util.xqy";
declare option xdmp:mapping "false";
let $params := map:map()
let $_ := for $i in xdmp:get-request-field-names() return map:put($params, $i, xdmp:get-request-field($i))
let $headers := eput:get-request-headers()
let $result := semmod:sparql-query($headers,$params,map:get($params, "query"))
let $response := semmod:results-payload($headers,$params,$result, ())
let $_ := xdmp:set-response-content-type($response[1])
return (
if (map:get($params, "callback")) then fn:concat(map:get($params, "callback"), "(") else (),
$response[2],
if (map:get($params, "callback")) then ")" else ()
)
But this now throws the error of:
XDMP-NONMIXEDCOMPLEXCONT: fn:data(<html xmlns="http://www.w3.org/1999/xhtml"><head><title>SPARQL results</title></head>...</html>) -- Node has complex type with non-mixed complex content
Which has lead me to the actual implementation of semantics-model.xqy
and I managed to track this back to 2 things: 1) the accepts header is not being sent propertly, 2) the data that gets returned is just not correct. But this is where my XQY knowledge has depleted and I'm totally stuck
from ml-lodlive.
I'm on mobile unfortunately. Send me a mail on my work address as a reminder, i might have a spare moment tomorrow.
Why are you stuck with jsonp? Never needed it myself.. 😉
from ml-lodlive.
I am running a Node.js app from where I would like to display a LodLive graph 😄
from ml-lodlive.
I just had an idea, I'll try to proxy my request ... 😄
from ml-lodlive.
Did proxying help?
from ml-lodlive.
@grtjn - yes it did help. Thanks. But I'd still like to see a working version of this lodlive.xqy :)
from ml-lodlive.
Related Issues (20)
- /data/ieee-skos.xml not correct RDF HOT 3
- Allow accepts override for backend calls
- Add css/ml-lodlive.css to bower.json main
- Add a Contributing.md
- Add editor/jshint configs
- Eliminate ajax-loader img (in favor of glyph or fa-icon)
- Publish release v0.2.3 HOT 2
- Dragging nodes offset bug HOT 2
- Scaling lodlive-graph-context div HOT 3
- `findInverseSameAs()` doesn't always invoke the callback
- lines aren't drawn with respect to node width HOT 2
- Access to retrieved data HOT 1
- Show iri instead of noName when no labels
- Is this a stable project? HOT 2
- init() should clear the graph
- Make query param configurable..
- Defensively copy jQuery HOT 1
- Not opening child nodes on click of .relatedBox. Node moves instead
- Too many concatenated relationships on line HOT 2
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 ml-lodlive.