Re: spring-neo4j DynamicProperties and Cypher queries

353 views
Skip to first unread message

Dorin Scutarasu

unread,
Feb 11, 2013, 2:45:58 AM2/11/13
to ne...@googlegroups.com
I realized I can escape the property key like this, using backticks :

start n=node:Person(`customProps-test`='testVal') return n;

However the above Cypher query returns no results. It seems that the dynamic properties are not indexed. Is there some way I could hook into the spring-neo4j persist process and update the index?

Cheers,
Dorin


On Friday, February 8, 2013 8:32:39 PM UTC+2, Dorin Scutarasu wrote:
I'm using http://static.springsource.org/spring-data/data-graph/snapshot-site/apidocs/org/springframework/data/neo4j/fieldaccess/DynamicProperties.html to add a Map-like property in my node entity.

My Code looks like this:

@NodeEntity public class Person {
    @Indexed(indexType = IndexType.SIMPLE)
    private DynamicProperties customProps;
    [...]
}

If I persist a Person object with a dynamic property foo=bar, the node that is created has a property named "customProperty-bar" with value "bar".

I can't seem to query the index using Cypher though:

neo4j-sh (0)$ start n=node:Person(customProps-foo="bar) return n;
==> SyntaxException: `=` expected
==> "start n=node:Person(customProps-foo="bar") return n"
==>                                 ^

Is there any workaround for this problem?

I'm using spring-data-neo4j 2.1.0-RELEASE and running Neo4j 1.8 in embedded mode.

Cheers,
Dorin

Michael Hunger

unread,
Feb 11, 2013, 3:50:59 AM2/11/13
to ne...@googlegroups.com
Hi,

right now indexing of dynamic properties is not supported yet, can you please raise a JIRA issue.

I can try to get it into 2.2.0-RELASE but cannot promise.

A bigger problem is: if I indexed a dynamic property-field what are the semantics of:

- looking up a single property-value of that collection
- looking up the whole collection
- What if someone defines a unique index on those? What are the semantics then, Should that be forbidden, etc.
  - there is already a similar issue with array properties which are indexed by neo4j one by one, for lookup you cannot pass in the array but only one of the entries
  - but the semantics for uniqueness are not really defined.

Michael

dlo...@asu.edu

unread,
Oct 7, 2013, 8:34:14 PM10/7/13
to ne...@googlegroups.com
Hello Micheal,

Thank you for the reply, I would need to use Dynamic properties functionality, since there is no indexing for it, Could you please suggest me the alternative way to get this done.

Thanks,
Lohith

Michael Hunger

unread,
Oct 8, 2013, 6:59:32 AM10/8/13
to ne...@googlegroups.com, Nicki Watt
Hi,

good question, what would be the use-case?

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

dlo...@asu.edu

unread,
Oct 8, 2013, 5:18:59 PM10/8/13
to ne...@googlegroups.com, Nicki Watt
Our usecase would contain a node with dynamic properties. We would be creating a common node object for number of entities like person, institute, course etc. The node could have 1 or more properties. and we need to GET the node based on these properties. Since dynamic property doesn't support a GET as it doesn't support indexing.
Could you please guide us an alternatively implementation of this use case.

Thanks,
Lohith

Dave Hallam

unread,
Jun 13, 2014, 9:29:39 AM6/13/14
to ne...@googlegroups.com, michael...@neotechnology.com
Hi Michael,

Did anything happen with this in the end?  I'm not seeing indexes on the individual keys (e.g. "metadata-phone") just the index on the main property itself (e.g. "metadata") using SDN 3.1.0.RELEASE.  

I'm trying to identify a way to drive a search web-ui with the fields driven by the indexed properties for a particular label.  The indexes seemed like a good hook in, but without the indexes for the dynamic properties being listed via the 
database.schema().getIndexes();
that's not going to work.

Would you have any other suggestions?

Many thanks,

Dave

Michael Hunger

unread,
Jun 14, 2014, 2:02:17 PM6/14/14
to Dave Hallam, ne...@googlegroups.com
Hi Dave,

good question. The same issues as mentioned before still exist. 
Especially that the keys of dynamic-properties are a runtime information, so we can't create indexes upfront.

Also for derived queries it would not be possible to identify which or if any index to use for the query.

Perhaps instead of looking into EmbeddedProperties it would be better to check out embedded entity support (there you could handle variability with subclasses) each of which could have annotations on entities to be indexed.

Michael
Reply all
Reply to author
Forward
0 new messages