-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Julien P.Lefebvre edited this page Feb 17, 2015
·
3 revisions
This is a gem project that aim to solve some semantic issue common to many ruby on rails web apps
1. Add semantic to the web
2. Be able to find semanticaly similar or different object from thousands objects
3. Make possible to compare object structure in the database without using graph database
4. Make possible to export structure from a relational database to other type of database
Example :
You have a list of 1000 pizza recipes but cant figure out how to display them usefully.
The most liked, and the most popular showed up first, then you have 50 pages unused and never displayed.
Solution : add the polyshape gem to the recipes model and its parts (ingredients, instructions steps, tags, etc)
It will make possible to compare recipe together and found the most similar or the most different recipe.
If someone looks for variant of the same recipe, set it to most similar.
If someone looks for different ideas, suggestions, set it to most different.
It can also be a slider to adjust this feature.
First I created a structure that use heavily the polymorphics capability of SQL database
I create one model that glue any model that as the "Acts as polyshape" module
This make possible for an object to include as chidren other polyshape object or to be include in another polyshape.
In this case Recipe are glued to instructions steps, ingredients and tags.
I created a bunch of helpers to be able to create, describe and print those object structure.
Then I expanded the Leveinstein algorithm. This algorithm makes possible string comparison.
It does check for iteration of character, addition of character and substraction of character.
I made it possible to be compare other things than strings. It now can compare sets of different class objects.
The result is then normalised, so it is not dependant on the length of the set.
My algorithm can compare the descendant object for a specific class type, or calculate one difference for each elements and give a resultant.
The resultant is based on the assumption that the different type of object are independent, which is not the case most of the time...
For example, steps in a recipes are dependant of their ingredient.
Finally, I create another model that is used to mimic the graph database structure. For each model of a type, it generate the difference and stock it in a field.
That field as to be populate with previous calculation, that speed up the access of data significantly (1000 folds).