Skip to content

Encountered a very strange bug and can't quite figure out what's going on. #145

@blackwint3r

Description

@blackwint3r

In the following example, I aim to find all the "sub-graph" of a named graph, then merge its own value with the values of the sub graph and output the result.

@prefix : <http://www.example.com/ns#> .
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

:g1 :sub-graph :g2.
:g1 :value {:a :b :c}.
:g2 :value {:bob :say {?x :can :fly}}. # This bug only occurs when `:g2` contains a graph, and within that graph, there exists a variable.
#:g2 :value {?bob :say {:x :can :fly}}. # Changing `:g2` to this works fine

# When parameter (`?gs`) is an empty list, the union of graphs should be an empty graph(i.e., true). However, `log:conjunction` will return false.
# Therefore, I additionally defined `:graph-union`.
{?gs :graph-union ?g} <= {?gs log:notEqualTo (). ?gs log:conjunction ?g.  }.
{?gs :graph-union true} <= {?gs log:equalTo (). }. 

# `:value2` merges the values of its subgraphs with its own value
{?g :value2 ?x } <= {
    ?g :value ?x1.
    [] e:findall (?x2 {?g :sub-graph ?g2. ?g2 :value2 ?x2} ?answer). 
    ?answer :graph-union ?x3.
    (?x3 ?x1) log:conjunction ?x.
}.

{:g1 :value2 ?x. "T0" log:trace  ?x.} => {:answer :is ?x}.

eye --pass-only-new --quiet test.n3 did not print the expected output( :answer :is ... ):

"T0" TRACE {
    :bob :say {
        ?_4986 :can :fly.
    }.
    :a :b :c.
}
@prefix : <http://www.example.com/ns#>.

What strikes me as most peculiar is that the log:trace statement could correctly print the debug message, yet this forward rule does not execute.
I also trace the results of the intermediate variables, and they were all correct. The only issue is that the final forward rule does not produce any output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions