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

Implement link creation algorithm #209

Open
andre-senna opened this issue Jan 24, 2025 · 0 comments
Open

Implement link creation algorithm #209

andre-senna opened this issue Jan 24, 2025 · 0 comments
Assignees
Milestone

Comments

@andre-senna
Copy link
Contributor

andre-senna commented Jan 24, 2025

Implement link creation algorithm

Example of query and link creation template:

AND
    LINK_TEMPLATE Expression 3 
        NODE Symbol EVALUATION 
        LINK_TEMPLATE Expression 2
            NODE Symbol PREDICATE
            VARIABLE V1
        LINK_TEMPLATE Expression 2
            NODE Symbol CONCEPT
            VARIABLE V2
    LINK_TEMPLATE Expression 3 
        NODE Symbol EVALUATION 
        LINK_TEMPLATE Expression 2
            NODE Symbol PREDICATE
            VARIABLE V3
        LINK_TEMPLATE Expression 2
            NODE Symbol CONCEPT
            VARIABLE V4
LINK_CREATE Expression 3 1
    NODE Symbol IMPLICATION
    LINK_CREATE Expression 3 0
        NODE Symbol EVALUATION
        V1
        V4
    LINK_CREATE Expression 3 0
        NODE Symbol EVALUATION
        V3
        V2
    CUSTOM_FIELD truth_value 2
        CUSTOM_FIELD mean 2
            count 1
            avg 0.9
        confidence 0.9

Algorithm

Inputs:

(a) Query: object describing a pattern matching query
(b) Link creation template: object describing the link structure which is supposed to be created
(c) Identifier of a processor which is supposed to be used to create the links based on 
    QueryAnswer objects
(d) N: number of QueryAnswer objects which are supposed to be used to create links

Actually, (b) and (c) are mutually exclusive so the caller should pass one or 
the other but not both.

Algorithm:

(1) Submit (a) to the Query Agent, eventually passing (d)
(2) Iterate through QueryAnswer objects:
    If (b) is defined
        use QueryAnswer assignments to get the values for each variable and add the request 
        to create new links to a BUNDLE
    else (meaning that (c) is defined)
        pass the QueryAnswer object to the proper function and get the links to be built as 
        response, adding them to the BUNDLE
(3) After finishing iteration (either because the Iterator is depleted or because the limit of (d) have 
    been reached), request the addition of links in the BUNDLE.

IMPORTANT:

We should prioritize the implementation of step (2) using (c). Only AFTER this use case is properly implemented we are supposed to go for (b).

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