From c3f7e7cf095180ca64fb9226963bc94bb2dac8ba Mon Sep 17 00:00:00 2001 From: Jos De Roo Date: Fri, 24 Jun 2022 00:12:13 +0200 Subject: [PATCH] Update n3.pest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the tbox rule `{?X :src_advisor ?Y} => {?X :advisor ?Y}.` we currently get ``` Loading data ABox and TBox thread 'main' panicked at 'Unable to read: Error { variant: ParsingError { positives: [WS], negatives: [] }, location: Pos(161), line_col: Pos((5, 9)), path: None, line: "{?X :src_advisor ?Y} => {?X :advisor ?Y}.␊", continued_line: None }', lib/src/n3_parser.rs:44:71 ``` Underscores are allowed in local name part of a qname and this PR is a quick hack to adsress that. --- lib/src/parsing/n3.pest | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/parsing/n3.pest b/lib/src/parsing/n3.pest index f4c76bd..b18b997 100644 --- a/lib/src/parsing/n3.pest +++ b/lib/src/parsing/n3.pest @@ -75,7 +75,8 @@ NewLine = { "\r" | "\n" } Var = {"?"~ASCII_ALPHA+~ASCII_ALPHANUMERIC*} Prefix = {"@prefix"~SPACE+~PrefixIdentifier~":"~SPACE+~"<"~Iri~">"~WS* ~"."~WS*} PrefixIdentifier = {ASCII_ALPHANUMERIC*} -Prefixed = {PrefixIdentifier ~":"~ASCII_ALPHANUMERIC+} +LocalNameChar = {ASCII_ALPHANUMERIC | "_"} +Prefixed = {PrefixIdentifier ~":"~LocalNameChar+} Term = {"<"~Iri~">" | Prefixed} varOrTerm = { Term | Var} Subject = { Term | Var} @@ -85,4 +86,4 @@ TP = { WS*~Subject ~WS+~ Property ~WS+~ Object ~WS* ~"."? ~WS* } Body = {"{"~TP+~"}"} Head = {"{"~WS*~TP~WS*~"}"} rule = { Body~WS*~"=>"~WS*~Head~WS*~"."? ~WS*} -document = {Prefix* ~ NewLine* ~rule+} \ No newline at end of file +document = {Prefix* ~ NewLine* ~rule+}