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

**URL:** <https://community.stardog.com/t/use-exists-node-iri-to-match-literal-with-stardog-rule/2690>\
**Category:** Support\
**Created:** [September 7, 2020, 9:58am UTC](https://community.stardog.com/t/use-exists-node-iri-to-match-literal-with-stardog-rule/2690 "2020-09-07T09:58:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crapthings](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/crapthings/32/686_2.png) [@crapthings](https://community.stardog.com/u/crapthings)\
**Post date:** [September 7, 2020, 9:58am UTC](https://community.stardog.com/t/use-exists-node-iri-to-match-literal-with-stardog-rule/2690/1 "2020-09-07T09:58:48Z")

</div>

exist tripples

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

:diablo a :Game ;
  :gen :RPG .

:justcause a :Game ;
    :name "just cause" ;
  :gen :OpenWorld .

```

```auto
:me :comment "i like gta and just cause".

```

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

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

```

```auto
[] 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 .
            }
        """ .
    

```

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [September 7, 2020, 10:30am UTC](https://community.stardog.com/t/use-exists-node-iri-to-match-literal-with-stardog-rule/2690/2 "2020-09-07T10:30:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [September 21, 2020, 10:30am UTC](https://community.stardog.com/t/use-exists-node-iri-to-match-literal-with-stardog-rule/2690/3 "2020-09-21T10:30:15Z")

</div>

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