How do I create my own rules in Jena Fuseki from string content?

122 views Asked by At

I am trying to create my own property rules in Jena Fuseki. To do so I am using the Generic Rule Reasoning that allows me to use my own rules. When I use this strategy with my rules from a file everything works fine:

:model_inf a ja:InfModel ; 
    ja:baseModel :tdbGraph ; 
    ja:reasoner [ 
        ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; 
        ja:rulesFrom <file://...> ;
    ] .

However, I would not want to use a file but add the rules directly as a string. I tried just to copy the content of the rule files that worked in the example above, for instance (a small slice of the file):

#-*-mode: conf-unix-*-
@prefix time: <http://www.w3.org/2006/time#>
@include <owlmicro>

-> table(owl:sameAs).

#---------------------------------------------------------------------------
# Equality
#---------------------------------------------------------------------------

sameAs_symmetry:
(?x owl:sameAs ?y)
-> (?y owl:sameAs ?x).

sameAs_transitivity:
(?x owl:sameAs ?y)
(?y owl:sameAs ?z)
-> (?x owl:sameAs ?x).

sameAs_Thing1:
-> [(?x rdf:type owl:Thing) <- (?x owl:sameAs ?y)].

sameAs_Thing2:
-> [(?x owl:sameAs ?x) <- (?x rdf:type owl:Thing)].

and put this in a variable string_rules_variable (with proper escaping):

:model_inf a ja:InfModel ; 
    ja:baseModel :tdbGraph ; 
    ja:reasoner [ 
        ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; 
        ja:rules [
            ${string_rules_variable}
        ] ;
    ] .

where ${string_rules_variable} (javascript string interpolation) contains the rules read from the file.

In the end, the repository was created with no error, but the rules doesn't worked nor the owlmicro statements appeared in the repository.

So, am I doing anything wrong, or is it a Jena Fuseki issue?

P.S. I am using nodejs to send this in the body of a post request with text/turtle content-type in headers.

0

There are 0 answers