{"action":"created","issue":{"url":"https://api.github.com/repos/opencog/atomspace/issues/1911","repository_url":"https://api.github.com/repos/opencog/atomspace","labels_url":"https://api.github.com/repos/opencog/atomspace/issues/1911/labels{/name}","comments_url":"https://api.github.com/repos/opencog/atomspace/issues/1911/comments","events_url":"https://api.github.com/repos/opencog/atomspace/issues/1911/events","html_url":"https://github.com/opencog/atomspace/issues/1911","id":382146452,"node_id":"MDU6SXNzdWUzODIxNDY0NTI=","number":1911,"title":"Reuse matched  execution/evaluation links in bindlink","user":{"login":"noskill","id":733626,"node_id":"MDQ6VXNlcjczMzYyNg==","avatar_url":"https://avatars1.githubusercontent.com/u/733626?v=4","gravatar_id":"","url":"https://api.github.com/users/noskill","html_url":"https://github.com/noskill","followers_url":"https://api.github.com/users/noskill/followers","following_url":"https://api.github.com/users/noskill/following{/other_user}","gists_url":"https://api.github.com/users/noskill/gists{/gist_id}","starred_url":"https://api.github.com/users/noskill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noskill/subscriptions","organizations_url":"https://api.github.com/users/noskill/orgs","repos_url":"https://api.github.com/users/noskill/repos","events_url":"https://api.github.com/users/noskill/events{/privacy}","received_events_url":"https://api.github.com/users/noskill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-11-19T10:22:37Z","updated_at":"2018-11-21T10:53:20Z","closed_at":null,"author_association":"NONE","body":"My proposal is to add new flag to bindink function to reuse matched execution/evaluation links in pattern matcher search:\r\n\r\nExample:\r\n```scheme\r\n(add-to-load-path \".\")\r\n\r\n(use-modules (opencog))\r\n(use-modules (opencog query))\r\n(use-modules (opencog exec))\r\n\r\n\r\n(Inheritance (Concept \"red\") (Concept \"color\"))\r\n(Inheritance (Concept \"blue\") (Concept \"color\"))\r\n(Inheritance (Concept \"green\") (Concept \"color\"))\r\n\r\n\r\n(define (schema2 A B)\r\n    (display \"Executing schema2 with \")\r\n    (display (list (cog-name A) (cog-name B)))\r\n    (newline)\r\n    (if (equal? (cog-name A) (cog-name B))\r\n        (Concept \"Same color\")\r\n        (Concept \"Different color\")))\r\n\r\n\r\n(define (classify A)\r\n    (display \"Executing predicate with \")\r\n    (display (cog-name A))\r\n    (newline)\r\n    (if (equal? (cog-name A) \"Same color\")\r\n        (stv 1 1)\r\n        (stv 0 1)))\r\n\r\n        \r\n(define bind-link\r\n    (BindLink\r\n        (VariableList\r\n            (Variable \"$X\")\r\n            (Variable \"$Y\"))\r\n        (And\r\n            (Inheritance\r\n                (Variable \"$X\")\r\n                (Concept \"color\"))\r\n            (Inheritance\r\n                (Variable \"$Y\")\r\n                (Concept \"color\"))\r\n            (Evaluation\r\n                (GroundedPredicate \"scm: classify\")\r\n                (ExecutionOutput\r\n                    (GroundedSchema \"scm: schema2\")\r\n                    (List\r\n                         (Variable \"$X\")\r\n                         (Variable \"$Y\"))\r\n                )\r\n            ))\r\n        (ExecutionOutput\r\n            (GroundedSchema \"scm: schema2\")\r\n                (List\r\n                   (Variable \"$X\")\r\n                   (Variable \"$Y\")))\r\n        )\r\n)\r\n(define result (cog-execute! bind-link))\r\n```\r\n\r\nHere we want to return from bindlink exactly what was matched and used in AndLink matching. Current implementation would recompute the ExecutionOutput link.\r\n\r\nOne way to implement it is to treat GroundedSchema as deterministic function and storing evaluations into temporary atomspace. That would allow for usage of many heuristics for reducing the search space: like minimum-remaining-value heuristic.\r\n"},"comment":{"url":"https://api.github.com/repos/opencog/atomspace/issues/comments/440621526","html_url":"https://github.com/opencog/atomspace/issues/1911#issuecomment-440621526","issue_url":"https://api.github.com/repos/opencog/atomspace/issues/1911","id":440621526,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDYyMTUyNg==","user":{"login":"vsbogd","id":983480,"node_id":"MDQ6VXNlcjk4MzQ4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/983480?v=4","gravatar_id":"","url":"https://api.github.com/users/vsbogd","html_url":"https://github.com/vsbogd","followers_url":"https://api.github.com/users/vsbogd/followers","following_url":"https://api.github.com/users/vsbogd/following{/other_user}","gists_url":"https://api.github.com/users/vsbogd/gists{/gist_id}","starred_url":"https://api.github.com/users/vsbogd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsbogd/subscriptions","organizations_url":"https://api.github.com/users/vsbogd/orgs","repos_url":"https://api.github.com/users/vsbogd/repos","events_url":"https://api.github.com/users/vsbogd/events{/privacy}","received_events_url":"https://api.github.com/users/vsbogd/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T10:53:20Z","updated_at":"2018-11-21T10:53:20Z","author_association":"CONTRIBUTOR","body":"I would separate following issues:\r\n(1) how to return the same thing which was calculated by ```ExecutionOutputLink``` during pattern matcher search (this issue)\r\n(2) how to not calculate ```ExecutionOutputLink``` with the same parameters twice if it is required (issue https://github.com/opencog/atomspace/issues/1907)\r\n\r\nThere are solutions for the (2) which also solve (1). For instance ```AtomspaceLink``` if I got the idea right. (my understanding ```AtomspaceLink``` will cause adding ```ExecutionOutputLink``` results to the atomspace in form of ```ExecutionLink```).\r\n\r\nI think ```CacheLink``` is not declarative enough to be a part of atomese. ```LetLink``` which I meant should not cache but just designate some part of the query to make sure the same part of query is used in few different places. And it cannot be used to solve problem (2), it solves only (1).  Yes, it is more similar to ```StateLink```."}}
{"actor":{"display_login":"vsbogd"}}