Skip to content

Commit 1bdfbb6

Browse files
author
Marco De Salvo
committed
Slight code optimization
1 parent 54d584c commit 1bdfbb6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

OWLSharp/Reasoner/RuleSet/OWLClassAssertionEntailmentRule.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@ internal static List<OWLInference> ExecuteRule(OWLOntology ontology, OWLReasoner
2626
List<OWLInference> inferences = new List<OWLInference>();
2727

2828
//Temporary working variables
29-
List<OWLEquivalentClasses> equivalentClassesAxioms = ontology.GetClassAxiomsOfType<OWLEquivalentClasses>();
30-
List<OWLDisjointClasses> disjointClassesAxioms = ontology.GetClassAxiomsOfType<OWLDisjointClasses>();
31-
List<OWLDisjointUnion> disjointUnionAxioms = ontology.GetClassAxiomsOfType<OWLDisjointUnion>();
32-
List<OWLClassExpression> inScopeClsExprs = new List<OWLClassExpression>(ontology.GetDeclarationAxiomsOfType<OWLClass>()
33-
.Select(ax => (OWLClass)ax.Entity));
34-
inScopeClsExprs.AddRange(reasonerContext.ClassAssertions.Select(ax => ax.ClassExpression));
35-
inScopeClsExprs.AddRange(equivalentClassesAxioms.SelectMany(ax => ax.ClassExpressions.Select(cls => cls)));
36-
inScopeClsExprs.AddRange(disjointClassesAxioms.SelectMany(ax => ax.ClassExpressions.Select(cls => cls)));
37-
inScopeClsExprs.AddRange(disjointUnionAxioms.Select(ax => ax.ClassIRI));
38-
inScopeClsExprs.AddRange(disjointUnionAxioms.SelectMany(ax => ax.ClassExpressions.Select(cls => cls)));
29+
List<OWLClassExpression> inScopeClsExprs =
30+
ontology.GetDeclarationAxiomsOfType<OWLClass>().Select(ax => (OWLClass)ax.Entity)
31+
.Union(reasonerContext.ClassAssertions.Select(ax => ax.ClassExpression))
32+
.Union(ontology.GetClassAxiomsOfType<OWLEquivalentClasses>().SelectMany(ax => ax.ClassExpressions.Select(cls => cls)))
33+
.Union(ontology.GetClassAxiomsOfType<OWLDisjointClasses>().SelectMany(ax => ax.ClassExpressions.Select(cls => cls)))
34+
.Union(ontology.GetClassAxiomsOfType<OWLDisjointUnion>().Select(ax => ax.ClassIRI))
35+
.Union(ontology.GetClassAxiomsOfType<OWLDisjointUnion>().SelectMany(ax => ax.ClassExpressions.Select(cls => cls))).ToList();
3936
foreach (OWLClassExpression inScopeClsExpr in OWLExpressionHelper.RemoveDuplicates(inScopeClsExprs))
4037
{
4138
inScopeClsExprs.AddRange(ontology.GetSuperClassesOf(inScopeClsExpr));

0 commit comments

Comments
 (0)