Comments (3)
A better way would be, if you want labels in your query result, you need to specify that using cypher. for example:
MATCH n
RETURN n
would not get you labels, but if specify
MATCH n
RETURN n, labels(n)
then you will get labels. This way we're using cypher instead of another optional parameter, and you wouldn't have to make an extra round-trip to neo4j to get the labels.
The algorithm which parses the query result would need to be intelligent enough to look for column names matching labels(x)
and interpret that column to be the labels for column x
.
For full compatibility, you would need to parse the original return statement to see if there were any AS
statements. For example:
MATCH n
RETURN n AS myNode, labels(n)
In this case, n
would not be a column name because it was aliased to myNode
, but the only way to know that is to check the original return statement.
As a first pass it probably isn't necessary to worry about this edge case though. You could get it working based on the first example, and then come back to this.
from neo4j-js.
And actually you can now create literal maps in cypher, e.g.
MATCH n
RETURN { data : n, labels: labels(n), id: id(n) } as node
from neo4j-js.
that solves the problem I was having. its not as necessary to code this now
from neo4j-js.
Related Issues (20)
- renaming refreshProperties to getProperties in Base class HOT 1
- Find by property HOT 3
- create unique node HOT 1
- Can't load root node by ID HOT 2
- Neo4jApi.js : modification is needed HOT 2
- Updating Nodes? HOT 3
- Code breaks in Neo4jApi.js at line number 319 HOT 1
- Neo4jApi.js error when performing a batch query HOT 3
- Returning mixed nulls and non-nulls in the same column throws an error/doesn't parse as Node HOT 1
- query returning strange results HOT 3
- Callback after succesfull batch execution HOT 1
- Graph.js: neo4j.Api.Request: Error Handling on Callback HOT 1
- .connect doesn't play nice with Bluebird Promises HOT 3
- Possible to pass node or relationship label into Graph.query() function? HOT 1
- Configurable Automatic Indexing
- Traversals
- Gremlin Plugin HOT 1
- Labels HOT 5
- Sample App, Development, transactional http endpoint HOT 4
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 neo4j-js.