Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query two relationships at a time in elgg_get_entity_from_relationships (Trac #2850) #2850

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 7 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/2850 on 41094667-04-17 by trac user dannyl, assigned to unknown.

Elgg version: 1.7

Right now elgg_get_entity_from_relationships can only handle querying based on one relationship at a time. It seems like it would make sense to be able to query based on two - for example: get all members of a group who are also a logged in user's friends.

D

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.7.8 by brettp on 41095698-04-14

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.7.9 by cash on 41207497-01-27

@elgg-gitbot
Copy link
Author

Milestone changed to Needs Review by cash on 41347210-01-22

@elgg-gitbot
Copy link
Author

cash wrote on 41418388-09-02

  1. Where does it stop? Just two relationships at a time or do we allow any arbitrary n relationships?
  2. Do we support multiple one hop constraints or do we allow multiple hop queries?

Examples:

One hop: * isFriendOf use[svn:1] AND * memberOf group1
[[BR]]Give me all the people who are friends of use[svn:1] who are also members of group1

Two hop: * isFriendOf ? AND ? memberOf group1
[[BR]]Give me all the people who are friends of a person who are members of group1

Right now we allow people to query based on multiple metadata (and it is possible for people to create really slow queries). It seems reasonable to provide similar support for relationships.

We have only had a single case that I can recall where we needed this and we did it through a custom where clause.

@elgg-gitbot
Copy link
Author

trac user dannyl wrote on 41418835-04-17

I agree. The one case we had - we also handled with custom where clause

I think we can close the ticket

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.9 by brettp on 41609863-01-21

@ewinslow
Copy link
Contributor

ewinslow commented Aug 8, 2014

I can envision some more handy use-cases (e.g. sharing with extended friends/friends-of-friends), but even that could be handled by computing the result and storing it explicitly in the DB so the query is only a one-hop.

And at the end of the day, I imagine if someone did need something this advanced and wanted to do so in a performant way, we're probably talking about using a real graph DB like Neo4J, rather than Elgg's relational structure.

@ewinslow ewinslow closed this as completed Aug 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants