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

Way to relate initial seed to output at the end of an operation chain #1345

Closed
gchqdev03 opened this issue Sep 27, 2017 · 7 comments
Closed
Assignees
Labels
enhancement Improvement to existing functionality/feature headliner Used to tag major items for release notes
Milestone

Comments

@gchqdev03
Copy link
Member

It would be really useful if there was a way to relate the results of a multihop operation chain to the initial seeds that were passed into the chain. If the operation chain has more than one operation and the end result elements/objects do not have an identifier that is easily relatable to any of the seeds that were passed in, then it is difficult to know which seeds resulted in which answers

@p013570
Copy link
Member

p013570 commented Sep 27, 2017

This is linked to #1301.

@p013570 p013570 added enhancement Improvement to existing functionality/feature p:high labels Sep 27, 2017
@p013570 p013570 added this to the Backlog milestone Sep 27, 2017
@p013570
Copy link
Member

p013570 commented Oct 5, 2017

After #1301 is done, we should then be able to create an Operation perhaps called 'ExtractItems'.
This would take an Iterable of Iterables and and returns an Iterable if the extracted item.

E.g
Input =
[
[1a, 2a, 3a],
[1b, 2b, 3b],
[1c, 2b, 3c]
]

and we ask to extract the second item out of the iterables then the result would be:
[2a, 2b, 2c]

This would allow us to create an Operation Chain like this:
Path(some seeds),
ExtractItems(0) - extract the first edge in each path
ToVertices(MATCHED_VERTEX) - this extracts the original seeds

@gchqdev03 - would that work for you?

@p013570 p013570 modified the milestones: Backlog, v1.0.2 Oct 5, 2017
@javadev001001
Copy link
Contributor

@p013570 I think that would work for our use-case. It'd be nice to be able to very easily 'pick up' properties as you traverse, but perhaps that's a separate issue?

@p013570
Copy link
Member

p013570 commented Oct 17, 2017

OK great. However, @javadev001001 - I'm not sure what you mean by 'pick up' properties?

@m607123
Copy link
Contributor

m607123 commented Nov 7, 2017

Just to clarify the desired behaviour for the extraction of items..
Given that the GetWalks (what was Path) operation could potentially return a Walk containing a Set of 2+ edges with the same source/destination, would one expect the output to :

  • contain as many extracted vertices as there are edges in this set, or
  • deduplicate these vertices so no matter the number of edges between the source/dest, the output only contains two vertices to represent all of the edges

@p013570
Copy link
Member

p013570 commented Nov 7, 2017

@m607123 the way your code currently looks seems to be going in the right direction. It allows users to plug in any map Function or flatMap Function so they can extract whatever they want.

So I would imagine they would do something like:

  • GetWalks
    This would return something like:
[
    [[1-2], [2-3], [3-4]],
    [[1-5], [5-6], [6-7]]
]
  • FlatMap(FirstItem)

This would return:

[
    [1-2],
    [1-5]
]
  • FlatMap(FirstItem)
    This would return:
[
    1-2,
    1-5
]
  • Map(Extract matched vertex - this might need to be a new function)
    Which would return:
[
    1,
    1
]
  • ToSet
    The deduplicated results:
[
    1
]

A bit complicated but quite descriptive. Perhaps we could have a function that merges the first 2 flatmap operations into 1.

m607123 added a commit that referenced this issue Nov 21, 2017
m607123 added a commit that referenced this issue Nov 22, 2017
m607123 added a commit that referenced this issue Nov 22, 2017
p013570 added a commit that referenced this issue Nov 23, 2017
@p013570
Copy link
Member

p013570 commented Nov 23, 2017

Merged into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality/feature headliner Used to tag major items for release notes
Projects
None yet
Development

No branches or pull requests

4 participants