Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-07-2020 06:31 AM
I was following a video "Using Public RDF Resources in Neo4j" on youTube and tried to run the query from the video in neosemantics app but I get an error
PREFIX neo: <neo://voc#>
CONSTRUCT{
?virus a neo:Virus, neo:WikidataNode ; neo:name ?virusName ;
neo:HAS_PARENT ?parentVirus ;
neo:LINKS_TO_MS_ACADEMIC_FOS ?msAcademicUri ;
neo:SAME_AS_DESCRIPTOR ?meshUri .
?parentVirus a neo:Virus .
}
WHERE {
?virus wdt:P171 + wd:Q808 ;
wdt:P171 ?parentVirus;
rdfs:label ?virusName ;
filter(lang(?virusName) = 'en') .
optional { ?virus wdt:P486 ?meshCode .
bind(URI(concat("http://id.nln.nih.gov/mesh/", ?meshCode)) as ?meshUri)}
optional { ?virus wdt:P6366 ?msAcademic .
bind(URI(concat("http://ma-graph.org/entity", ?msAcademic)) as ?msAcademicUri)}
} limit 5
Error Running Query
Invalid input ''': expected 'd/D' (line 2, column 587 (offset: 614)) " 'https://query.wikidata.org/sparql?query=PREFIX%20neo%3A%20<neo%3A%2F%2Fvoc%23> CONSTRUCT{ %3Fvirus%...)%20.%0A%0Aoptional%20%7B%20%3Fvirus%20wdt%3AP486%20%3FmeshCode%20.%20%0A%09%09bind(URI(concat(%22http%3A%2F%2Fid.nln.nih.gov%2Fmesh%2F%22%2C%20%3FmeshCode))%20as%20%3FmeshUri)%7D%0Aoptional%20%7B%20%3Fvirus%20wdt%3AP6366%20%3FmsAcademic%20.%20%0A%09%09bind(URI(concat(%22http%3A%2F%2Fna-graph.org%2Fentity%22%2C%20%3FmsAcademic))%20as%20%3FmsAcademicUri)%7D%0A%7D%20limit%205%20'," ^
This query works perfectly fine in wikidata query service that's why I'm wondering what's the problem with running it in neosemantics.
EDIT:
When I run the same query in wikidata, copy Url and run it in neosemantics using Fetch from URL as RDF datasource everything works. But I still get the error when using a SPARQL query as a a datasource
10-07-2020 09:08 AM
Hi @maarriaa, nice catch
I've been trying it at my end and I've noticed that the n10s app is not escaping properly the single quotes. If you try the same query but using filter(lang(?virusName) = "en") .
instead of the single-quoted version then it all works fine.
I've shared it with @adam.cowley to try and understand if there's a reason for the special treatment of single quotes.
Cheers,
JB
10-07-2020 10:25 AM
Thank you for the answer!
All the sessions of the conference are now available online