neo4j: lucene ParseException: cannot parse 'bbox' - neo4j

I am using ruby with neography backed by neo4j with spatial extension.
The following error occured:
org.apache.lucene.queryParser.ParseException: Cannot parse 'bbox:[11.6,11.4,47.1,48.2]': Encountered \" \"]\" \"] \"\" at line 1, column 25.\nWas expecting one of:\n \"TO\" ...\n ...\n ...\n " (Neography::BadInputException)
This is the query:
start n = node:road_nodes('bbox:[11.6,11.4,47.1,48.2]') return n
The same error occurs if I put the query in the web-frontend of neo4j:
(Neo.DatabaseError.Statement.ExecutionFailure)
with the error-message like above:
org.apache.lucene.queryParser.ParseException: Cannot parse 'bbox:[11.6,11.4,47.1,48.2]': Encountered " "]" "] "" at line 1, column 25.
Was expecting one of:
"TO" ...
...
...

Answer to my own question:
This error occurs, when there is no spatial index.
In my case I forgot to create the spatial index after I reset the whole database.
So the solution to this "parse error" is to simply create the spatial index.

Related

Invalid regular expression: '(\d)(?=(\d{3})+$) in Tableau

I am trying to add the thousands operators in my labels in Tableau by using REGEXP_REPLACE:
'$' + REGEXP_REPLACE(STR(ROUND(SUM([Metrcs num]),0)),"(\d)(?=(\d{3})+$)", "$0,")
but the following error occurs: Invalid regular expression: '(\d)(?=(\d{3})+$)', no argument for repetition operator: ?
I am wondering how I can fix it.

apoc.merge.node with special identifier fails

I tried to merge a node with apoc.merge.node but my ident property keys have a special char(:) and get double escaped. Did i miss something or does a workaround exist?
If i replace the ":" with "_" everything works as expected.
Neo4j 4.2.1 community and APOC 4.2.0
CALL apoc.merge.node(["test"], apoc.map.fromPairs([["i:d","123"]])) YIELD node return node
Error
Failed to invoke procedure `apoc.merge.node`: Caused by: org.neo4j.exceptions.SyntaxException: Invalid input 'i': expected "}" (line 1, column 17 (offset: 16))
"MERGE (n:test{``i:d``:$identProps.``i:d``}) ON CREATE SET n += $onCreateProps ON MATCH SET n += $onMatchProps RETURN n"
EDIT
It seems there is a bug in APOC which causes the identifier to be encoded twice.
First with Util::quote https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/4.1/core/src/main/java/apoc/util/Util.java#L674
And then in the merge procedure https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/4.1/core/src/main/java/apoc/merge/Merge.java#L85
I've filed an issue: https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1783
In Neo4j, you can use backticks ` around a key that contain special characters :
CALL apoc.merge.node(["test"], apoc.map.fromPairs([["`i:d`","123"]]))
YIELD node
return node
Same is true everywhere in the Cypher syntax, escaping a label with a whitespace for eg :
MERGE (n:`Land Vehicle` {id: "land-rover-1"})

Fuseki failed uploading my protege data, keep giving me errors

I am trying to upload my ontology that I built using protege version 5.2.0 to Apache Jena Fuseki server
I save the file in .ttl format and when I tried uploading it I got
Result: failed with message "Parse error: [line: 1765, col: 3 ]
Triples not terminated by DOT"
what I have in line 1765 is
rdfs:label "Sequence accession", "sequence accession"#en .
Here is few lines in my .ttl file around line 1765
ns0:IAO_0000412 "EDAM" ; ns1:hasDefinition "A persistent, unique
identifier of a molecular sequence database entry." ;
ns1:hasExactSynonym "Sequence accession number" ; ns1:inSubset
ns0:edam#data, ns0:edam#edam, ns0:edam#identifiers ; rdfs:label
"Sequence accession", "sequence accession"#en .
ns0:BFO_0000001 a owl:Class ; rdfs:subClassOf owl:Thing ;
I then tried saving the file in OWL/XML format and I got
Result: failed with message "Parse error: [line: 20, col: 88] {E201} Multiple children of property element"
So I keep getting syntax error with every format I tried to upload
any suggestions in how to fix that ??
Many Thanks

How to delimit this cypher query because there is a syntax error caused by the label name

This Cypher statement causes a syntax error:
CREATE (mediawiki-1.27:Schema { key: mediawiki-1.27, name:mediawiki-1.27})
The error seems to be caused by the - character in the node label:
Invalid input '1': expected whitespace, [ or '-' (line 1, column 19 (offset: 18))
"CREATE (mediawiki-1.27:Schema { key: mediawiki-1.27, name:mediawiki-1.27})"
Dashes and dots are not allowed in variable names. You can surround the variable name with backticks to escape it.
Also I'm guessing your key and name values are strings, in which case make sure to surround them with quotes:
CREATE (`mediawiki-1.27`:Schema { key:'mediawiki-1.27', name:'mediawiki-1.27'})

Do not understand the error in Neo4j creation of nodes.

I am trying to create a node
create (n:node0{78 : 78});
This results in an error of
Invalid input ':': expected whitespace, comment or '}' (line 1, column 20 (offset: 19))
"create (n:node0{78 : 78})"
^
The book I am following "Learning Neo4j" by Bruggen, Packt Publishing.
My guess is that "78" cannot be a key name (most likely because it starts with a digit) and the correct code should be like
create (n:node0{param78: 78})

Resources