Use exists node(iri) to match literal with stardog rule?

exist tripples

:gta a :Game  ;
  :name "gta" ;
  :gen :OpenWorld .

:diablo a :Game ;
  :gen :RPG .

:justcause a :Game ;
    :name "just cause" ;
  :gen :OpenWorld .
:me :comment "i like gta and just cause".

any possible to use exist resource to make this rule work by not hardcode literal value?

[] a rule:SPARQLRule ;
        rule:content """
            IF {
                ?person :comment ?comment .
                FILTER (regex(?comment, "gta|just cause")) . 
                FILTER (regex(?comment, "like")) .
            }
            THEN {
                ?person a :OpenWorldGamer .
            }
        """ .
    
[] a rule:SPARQLRule ;
        rule:content """
            IF {
                ?person :comment ?comment .
                FILTER (regex(?comment, "gta|just cause")) . 
                FILTER (regex(?comment, "don't like")) .
            }
            THEN {
                ?person a :NotAnOpenWorldGamer .
            }
        """ .
    

No, you cannot really parameterise rules (or axioms) in this way. You'd have to move the parameterised part into queries and use different values in different queries.

Cheers,
Pavel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.