From bbf3211328102b828abee89fbbb2402b2772e115 Mon Sep 17 00:00:00 2001 From: Martin Larralde Date: Mon, 17 Jun 2024 19:54:39 +0200 Subject: [PATCH] Fix remaining issues with Manchester lexer --- src/grammars/omn.pest | 4 ++-- src/io/omn/reader.rs | 13 +++++++++++++ src/ont/owl-manchester/multi-has-key.omn | 3 +-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/grammars/omn.pest b/src/grammars/omn.pest index 130eb29..0237103 100644 --- a/src/grammars/omn.pest +++ b/src/grammars/omn.pest @@ -293,7 +293,7 @@ ClassSubClassOfClause = { "SubClassOf:" ~ DescriptionAnnotatedList } ClassEquivalentToClause = { "EquivalentTo:" ~ DescriptionAnnotatedList } ClassDisjointWithClause = { "DisjointWith:" ~ DescriptionAnnotatedList } ClassDisjointUnionOfClause = { "DisjointUnionOf:" ~ Annotations? ~ Description2List } -ClassHasKeyClause = { "HasKey:" ~ Annotations? ~ PropertyExpression+ } +ClassHasKeyClause = { "HasKey:" ~ Annotations? ~ PropertyExpression ~ (COMMA ~ PropertyExpression)* } ClassClause = { ClassAnnotationsClause | ClassSubClassOfClause @@ -446,7 +446,7 @@ SWRLAtom = { | DataPropertyIRI ~ LBRACKET ~ SWRLIObject ~ COMMA ~ SWRLDObject ~ RBRACKET | "SameAs" ~ LBRACKET ~ SWRLIObject ~ COMMA ~ SWRLIObject ~ RBRACKET | "DifferentFrom" ~ LBRACKET ~ SWRLIObject ~ COMMA ~ SWRLIObject ~ RBRACKET - | "BuiltIn" ~ LBRACKET ~ SWRLBuiltinID ~ (COMMA ~ SWRLDObject)* ~ RBRACKET + | SWRLBuiltinID ~ LBRACKET ~ SWRLDObject ~ (COMMA ~ SWRLDObject)* ~ RBRACKET } SWRLBuiltinID = { IRI } diff --git a/src/io/omn/reader.rs b/src/io/omn/reader.rs index c5a8131..d453da7 100644 --- a/src/io/omn/reader.rs +++ b/src/io/omn/reader.rs @@ -39,4 +39,17 @@ pub mod test { Err(e) => panic!("parser failed: {}", e), } } + + #[test] + fn test_property_expression() { + OwlManchesterLexer::lex(Rule::PropertyExpression, "o:r").unwrap(); + } + + + #[test] + fn test_has_key() { + let _ = OwlManchesterLexer::lex(Rule::ClassHasKeyClause, "HasKey:\no:r\n").unwrap(); + let _ = OwlManchesterLexer::lex(Rule::ClassHasKeyClause, "HasKey:\no:r, o:s\n").unwrap(); + } + } diff --git a/src/ont/owl-manchester/multi-has-key.omn b/src/ont/owl-manchester/multi-has-key.omn index 29b061a..687a45b 100644 --- a/src/ont/owl-manchester/multi-has-key.omn +++ b/src/ont/owl-manchester/multi-has-key.omn @@ -25,7 +25,6 @@ DataProperty: o:A Class: o:C HasKey: - o:r, - o:s + o:r, o:s