-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marco De Salvo
committed
Jan 8, 2025
1 parent
e3170e5
commit cefe26a
Showing
31 changed files
with
533 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
OWLSharp.Test/Extensions/TIME/Validator/RuleSet/TIMEInstantAfterAnalysisRuleTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
Copyright 2014-2025 Marco De Salvo | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OWLSharp.Extensions.TIME; | ||
using OWLSharp.Ontology; | ||
using OWLSharp.Validator; | ||
using RDFSharp.Model; | ||
|
||
namespace OWLSharp.Test.Extensions.TIME | ||
{ | ||
[TestClass] | ||
public class TIMEInstantAfterAnalysisRuleTest : TIMETestOntology | ||
{ | ||
#region Tests | ||
[TestMethod] | ||
public async Task ShouldAnalyzeInstantAfterAndViolateRule1() | ||
{ | ||
OWLOntology ontology = new OWLOntology(TestOntology); | ||
ontology.DeclarationAxioms.AddRange([ | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantA"))), | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
]); | ||
ontology.AssertionAxioms.AddRange([ | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA"))), | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.AFTER), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.AFTER), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA"))), //clash | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.AFTER), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
]); | ||
List<OWLIssue> issues = await TIMEInstantAfterAnalysisRule.ExecuteRuleAsync(ontology); | ||
|
||
Assert.IsNotNull(issues); | ||
Assert.IsTrue(issues.Count == 2); | ||
Assert.IsTrue(issues[0].Severity == OWLEnums.OWLIssueSeverity.Error); | ||
Assert.IsTrue(string.Equals(issues[0].RuleName, TIMEInstantAfterAnalysisRule.rulename)); | ||
Assert.IsTrue(string.Equals(issues[0].Description, TIMEInstantAfterAnalysisRule.rulesugg1)); | ||
Assert.IsTrue(issues[1].Severity == OWLEnums.OWLIssueSeverity.Error); | ||
Assert.IsTrue(string.Equals(issues[1].RuleName, TIMEInstantAfterAnalysisRule.rulename)); | ||
Assert.IsTrue(string.Equals(issues[1].Description, TIMEInstantAfterAnalysisRule.rulesugg1)); | ||
} | ||
|
||
[TestMethod] | ||
public async Task ShouldAnalyzeInstantAfterAndViolateRule2() | ||
{ | ||
OWLOntology ontology = new OWLOntology(TestOntology); | ||
ontology.DeclarationAxioms.AddRange([ | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantA"))), | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
]); | ||
ontology.AssertionAxioms.AddRange([ | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA"))), | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLClassAssertion( | ||
new OWLClass(RDFVocabulary.TIME.INSTANT), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.AFTER), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB"))), | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.BEFORE), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantB"))), //clash | ||
new OWLObjectPropertyAssertion( | ||
new OWLObjectProperty(RDFVocabulary.TIME.AFTER), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantA")), | ||
new OWLNamedIndividual(new RDFResource("ex:InstantC"))), | ||
]); | ||
List<OWLIssue> issues = await TIMEInstantAfterAnalysisRule.ExecuteRuleAsync(ontology); | ||
|
||
Assert.IsNotNull(issues); | ||
Assert.IsTrue(issues.Count == 1); | ||
Assert.IsTrue(issues[0].Severity == OWLEnums.OWLIssueSeverity.Error); | ||
Assert.IsTrue(string.Equals(issues[0].RuleName, TIMEInstantAfterAnalysisRule.rulename)); | ||
Assert.IsTrue(string.Equals(issues[0].Description, TIMEInstantAfterAnalysisRule.rulesugg2)); | ||
} | ||
#endregion | ||
} | ||
} |
Oops, something went wrong.