opencog / atomspace

The OpenCog (hyper-)graph database and graph rewriting system
https://wiki.opencog.org/w/AtomSpace
Other
801 stars 225 forks source link

PMCB's node_match pathing question #93

Closed williampma closed 9 years ago

williampma commented 9 years ago

Anyone know why didn't this pattern in the test match to anything?

https://github.com/opencog/atomspace/blob/8112ab7731bea56a635d402bac80d46ebea5b94c/tests/query/MissingUTest.cxxtest

I overwrote node_match to allow any node to match to VariableNode, so this should results in (ConceptNode "John") being matched to (VariableNode "$Z"), but the Pattern Matcher didn't even go into the node_match callback and produced no grounding.

It only does this in some cases. For example, with the current bc-example.scm (https://github.com/opencog/atomspace/blob/master/tests/rule-engine/bc-example.scm) searching

(ImplicationLink
 (VariableNode "$A")
 (InheritanceLink
  (ConceptNode "Fritz")
  (ConceptNode "green")
  )
)

can match (ConceptNode "Fritz") to (VariableNode "$Z"). However, as soon as I changed to search for a non-existence name

(ImplicationLink
 (VariableNode "$A")
 (InheritanceLink
  (ConceptNode "RandomName")
  (ConceptNode "green")
  )
)

it fails to match to (VariableNode "$Z"). Not sure if there's something I am not seeing with the pattern. Maybe some path exploration problem that only happens on some rare instances when a node is to be matched to another node that is already wrapped by another VariableNode?

leungmanhin commented 9 years ago

Perhaps it started with (ConceptNode "RandomName") and couldn't find any of its incoming set (because it did not exist) so the search ended that way before going to any callback?

williampma commented 9 years ago

Ah, right, that makes sense. I completely forgot about those starting criteria. I should be looking at those method then. Thanks!