Hi there...

I am looking at moving a website to a model based on Neo4J, however, I am
having trouble seeing how to optimise the 'main query' type for Neo4J.

Briefly, the site consists of posts, each tagged with various attributes,
e.g. (its a travel site) location, theme, cost etc... Also the tags
are hierarchical. So, for location we have (say) 'tuscany' inside 'italy'
inside 'europe'. For theme we have (say) 'cycling' inside 'activity'.

I can beautifully model the parent child relationships of these 'tags' using
a graph Db as objects with a 'CHILD_OF' relationship type. Then the posts go
in and have related 'tags' related to them with a 'TAGGED_WITH' relationship
types. Fine.

However, here is the complex bit (well to me): I need to be able to find all
posts tagged with a set of tags (AND operation so each post must be tagged
with each tag).

Whats more, these queries need to respect the parent relationships in the
tags. So if I search for 'activity' in 'france' it needs to traverse the
CHILD_OF relationships to find things tagged with any child of 'activity'
AND any child of 'France'.

It seems pretty easy to write a traversal class that would find all posts in
any child of ether 'tag' node, simply follow 'CHILD_OF' and 'TAGGED_WITH'
backwards and return nodes of type post.

However how to do the AND bit? The only way I can see is to return both
lists and union them in user code... however that seems inelegant and may
not scale brilliantly.

Any ideas how to optimise?

Al
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to