Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Provide filter method for entities #111

Open
neogermi opened this Issue · 2 comments

2 participants

@neogermi

Though a developer could use the underscore filter method. It might be worth giving the developer some convenience methods at hand to enable him/her to filter entities

  • by Type
  • by Attribute

directly within VIE.

I'm thinking of something like:

var persons = vie.entities.filter({type: "Person"});
var entitiesWithNames = vie.entities.filter({attributes: [{"schema:name" : "*"}]});
var personsWithNameParis = vie.entities.filter({attributes: [{"type: "Person", "schema:name" : "Paris*"}]});

The idea here is to provide simple implementations of often-used functionality. Not to provide a full scope of all possible filter queries. For that, the native filter method should be used (which is still possible, given the above syntax).

@bergie
Owner

Sounds very useful. Have you seen the new Collection where method in Backbone? That would probably be the right place instead of filter

@neogermi

No, haven't seen that before but I just gave it a try. My only issue with this is that it is actually a bit too simple. No regular expressions seem to work here. And filtering for types including their hierarchy would not be possible with that.

I will work on the above API during this week's hackathon in Copenhagen and we can discuss on this in Salzburg the week after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.