On 09/10/2020 13:46, Marcelo Machado wrote:
Yes, that is the problem, ja:rule does not accept some directives. If the
problem was just prefixes I could resolve that by parsing the entire
content, however, I use some directives like @include to add other owl
rules.
If I use ja:rulesFrom with <file://...> everything works fine. But in that
case, I have to save the file in my server and I would not like to do that.
If not ja:rule I don't know what to do so, I didn't find any doc about that
(actually seams that what I want is not possible with fuseki).
I've created a ticket
https://issues.apache.org/jira/browse/JENA-1977
and also a tried a quick hack that didn't cause the test suite to
complain so it may be possible to add the header @-directs (and
incidently comments) processing.
How are you getting Fuseki? If it is one of the downloads, could you
test a development build which would speed getting a fix done in time
for the next release.
Andy
At.te,
Marcelo de Oliveira Costa Machado
Em sex., 9 de out. de 2020 às 08:47, Andy Seaborne <[email protected]>
escreveu:
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