Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

api: add transitive search #66

Merged
merged 1 commit into from
Sep 18, 2015

Conversation

jbenito3
Copy link
Member

  • Adds an extra Model that keeps track of all the equivalent IDs.
    (closes api: optional recursion of transitive relations #49)
  • Enables transitive queries to fetch all the related claims (through
    /claims?type=xxx&value=yyy&recurse=1.
  • Adds a new API resource /eqids to list all the equivalent IDs (one can also
    filter by a specific id using the argument eqid=).

Signed-off-by: Jose Benito Gonzalez Lopez jose.benito.gonzalez@cern.ch

@classmethod
def equivalents(cls, type_name, value):
"""Get claims with the all the equivalent subjects or objects."""
all_eq_ids = EquivalentIdentifier.equivalent_ids(type_name, value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we introduce an eqid concept, let's change all occurrences of eq_id to eqid for greater consistency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jbenito3 jbenito3 force-pushed the 49-transitive-relations branch 2 times, most recently from 084b246 to af8fc12 Compare September 18, 2015 12:56
@jbenito3
Copy link
Member Author

@tiborsimko I have applied all te modifications that you have suggested. I have also taken the time to add 2 extra commands:

  • claimstore index clear_eqids
  • claimstore index rebuild_eqids

@tiborsimko
Copy link
Member

Nice and useful addition with the eqid CLI commands!

BTW, since we use dropalldb (that we could probably rename to dropdb), what about renaming "clear" to "drop" here too? Perhaps a schema like:

claimstore help
claimstore collect
claimstore run
claimstore shell
claimstore database create
claimstore databate populate
claimstore database drop
claimstore eqid drop
claimstore eqid reindex

But we can take another issue to think about new nice and clean CLI option tree...

@jbenito3
Copy link
Member Author

@tiborsimko I liked your proposal and I have just done it.

* Adds an extra Model that keeps track of all the equivalent IDs.
  (closes inveniosoftware#49)

* Enables transitive queries to fetch all the related claims (through
  `/claims?type=xxx&value=yyy&recurse=1`.

* Adds a new API resource `/eqids` to list all the equivalent IDs
  (one can also filter by a specific id using the argument `eqid=`).

* Adds command `claimstore index` in order to do operations with
  indeces. For instance: `claimstore index clear_eqids` and
  `claimstore index rebuild_eqids`.

Signed-off-by: Jose Benito Gonzalez Lopez <jose.benito.gonzalez@cern.ch>
@tiborsimko tiborsimko merged commit ad1195d into inveniosoftware:master Sep 18, 2015
@jbenito3 jbenito3 deleted the 49-transitive-relations branch September 20, 2015 16:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api: optional recursion of transitive relations
2 participants