Skip to content

Commit

Permalink
Fix remaining issues with Manchester lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Jun 17, 2024
1 parent 262b3be commit bbf3211
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/grammars/omn.pest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down
13 changes: 13 additions & 0 deletions src/io/omn/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
3 changes: 1 addition & 2 deletions src/ont/owl-manchester/multi-has-key.omn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DataProperty: o:A
Class: o:C

HasKey:
o:r,
o:s
o:r, o:s


0 comments on commit bbf3211

Please sign in to comment.