On 08/10/2020 19:22, Marcelo Machado wrote:
Hello Andy,
I manually escaped \n and " characters and some errors were corrected,
thanks. However, consider that I want to use the following string rules (
string_rules_variable):
I think (maybe someone can confirm) ja:rule is one or more rules, but
not a full rules file with features of prefixes and other directives.
Does a rule if you use URIs?
Andy
#-*-mode: conf-unix-*-
@prefix time: <http://www.w3.org/2006/time#>
@include <owlmicro>
-> table(owl:sameAs).
#-----------------------------
sameAs_symmetry:
(?x owl:sameAs ?y)
-> (?y owl:sameAs ?x).
And as I said before this is how I am using in fuseki:
:model_inf a ja:InfModel ;
ja:baseModel :tdbGraph ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ;
ja:rule "[string_rules_variable]"`;
But Fuseki is not recognizing prefix:
org.apache.jena.assembler.exceptions.AssemblerException: caught:
Expected '(' at start of clause, found @prefix
Do you have any thoughts on how to solve this?
Thanks in advance!
At.te,
Marcelo de Oliveira Costa Machado
Em qui., 8 de out. de 2020 às 05:47, Andy Seaborne <[email protected]>
escreveu:
On 08/10/2020 07:41, Marcelo Machado wrote:
I am trying to create my own property rules in 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 in 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, but the repository was not created, apparently due to
special characters (e.g. #, \n...):
:model_inf a ja:InfModel ;
ja:baseModel :tdbGraph ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner>
;
ja:rule "[${string_rules_variable}]"`;
At a minimum that will need Turtle escapes for newlines. A NodeFormatter
formst outout - the Turtle rules are available directly via
EscapeStr.stringEsc(string).
The full grammar details are here: https://www.w3.org/TR/turtle/#terminals
If you need to be it your self, it'll need newline and " handling, two
character \n and \"
Andy
] .
where ${string_rules_variable} (javascript string interpolation) contains
the rules read from the file.
So, what am I doing wrong? I believe this is about escaping special
characters, if so, what would be the way to resolve it?
At.te,
Marcelo de Oliveira Costa Machado