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

Match Multiple in Single Rule #12

Open
sdiemert opened this issue Jun 11, 2020 · 2 comments
Open

Match Multiple in Single Rule #12

sdiemert opened this issue Jun 11, 2020 · 2 comments

Comments

@sdiemert
Copy link
Contributor

It would be helpful to capture and operate on all of the nodes that match a particular pattern in one rule. This might be analgous to a "for all" statement in first order logic.

For example, to fire a worker from an organization you might have delete them from multiple departments. See #11 for example.

(rule 'fire-worker ['name]
    :read (pattern 
                 (node 'w :label "Worker" :asserts {:name 'name})
                 (node 'c :label "Company")
                 (node 'd :label "Department" :all)
                 (edge 'e1 :label "employer" :src 'w :tar 'c)
                 (edge 'e2 :label "in_dept" :src 'w :tar 'd)
    :delete ['e1 'e2])

This issue might superceed #11 since you can simple match multiple (0) versions of pattern.

@jenshweber - we discussed one way of doing this with "meta-rules", is that still the preferred solution?

@sdiemert
Copy link
Contributor Author

Alternative syntax might be something like...

(pattern 
   (node 'n1 :label "foo")
   (forall 
        (node 'n2 :label "bar")
        (edge 'e :label "foobar" :src 'n1 :tar 'n2)))

This would match a single node labelled foo and all of the adjcent nodes (via edge foobar) that are themselves labelled bar.

@jenshweber
Copy link
Owner

Yes, this would be good. I am not sure how difficult this will be though. I'll have to think about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants