Skip to content

Commit

Permalink
Typo in comments + Make rules have an Uri instead of a string name
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco authored and Marco committed Jul 16, 2021
1 parent c517841 commit 64969da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
10 changes: 5 additions & 5 deletions RDFSharp/Semantics/OWL/RDFSemanticsEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ public enum RDFOntologyStandardReasonerRule
/// </summary>
EquivalentPropertyTransitivity = 5,
/// <summary>
/// P(F1,F2) ^ DOMAIN(P,C) -> TYPE(F1,C)
/// P(F1,F2) ^ DOMAIN(P,C) -> C(F1)
/// </summary>
DomainEntailment = 6,
/// <summary>
/// P(F1,F2) ^ RANGE(P,C) -> TYPE(F2,C)"
/// P(F1,F2) ^ RANGE(P,C) -> C(F2)
/// </summary>
RangeEntailment = 7,
/// <summary>
/// SAMEAS(F1,F2) ^ SAMEAS(F2,F3) -> SAMEAS(F1,F3
/// SAMEAS(F1,F2) ^ SAMEAS(F2,F3) -> SAMEAS(F1,F3)
/// </summary>
SameAsTransitivity = 8,
/// <summary>
Expand Down Expand Up @@ -264,11 +264,11 @@ public enum RDFOntologyStandardReasonerRule
/// </summary>
SameAsEntailment = 17,
/// <summary>
/// C(F1) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASVALUE(R,F2) => P(F1,F2)
/// C(F1) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASVALUE(R,F2) -> P(F1,F2)
/// </summary>
HasValueEntailment = 18,
/// <summary>
/// C(F) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASSELF(R,"TRUE") => P(F,F)
/// C(F) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASSELF(R,"TRUE") -> P(F,F)
/// </summary>
HasSelfEntailment = 19,
/// <summary>
Expand Down
17 changes: 7 additions & 10 deletions RDFSharp/Semantics/OWL/Reasoner/Algebra/RDFOntologyReasonerRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ You may obtain a copy of the License at
limitations under the License.
*/

using RDFSharp.Model;
using System;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace RDFSharp.Semantics.OWL
Expand All @@ -29,9 +28,9 @@ public class RDFOntologyReasonerRule
{
#region Properties
/// <summary>
/// Name of the rule
/// Uri of the rule
/// </summary>
public string RuleName { get; internal set; }
public Uri RuleUri { get; internal set; }

/// <summary>
/// Description of the rule
Expand All @@ -53,18 +52,16 @@ public class RDFOntologyReasonerRule
/// <summary>
/// Default-ctor to build a rule with given antecedent and consequent
/// </summary>
public RDFOntologyReasonerRule(string ruleName, string ruleDescription, RDFOntologyReasonerRuleAntecedent antecedent, RDFOntologyReasonerRuleConsequent consequent)
public RDFOntologyReasonerRule(Uri ruleUri, string ruleDescription, RDFOntologyReasonerRuleAntecedent antecedent, RDFOntologyReasonerRuleConsequent consequent)
{
if (string.IsNullOrEmpty(ruleName))
throw new RDFSemanticsException("Cannot create rule because given \"ruleName\" parameter is null or empty");

if (ruleUri == null)
throw new RDFSemanticsException("Cannot create rule because given \"ruleUri\" parameter is null");
if (antecedent == null)
throw new RDFSemanticsException("Cannot create rule because given \"antecedent\" parameter is null");

if (consequent == null)
throw new RDFSemanticsException("Cannot create rule because given \"consequent\" parameter is null");

this.RuleName = ruleName;
this.RuleUri = ruleUri;
this.RuleDescription = ruleDescription;
this.Antecedent = antecedent;
this.Consequent = consequent;
Expand Down
6 changes: 3 additions & 3 deletions RDFSharp/Semantics/OWL/Reasoner/RDFOntologyReasoner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public RDFOntologyReasoner AddStandardRule(RDFSemanticsEnums.RDFOntologyStandard
/// </summary>
public RDFOntologyReasoner AddCustomRule(RDFOntologyReasonerRule customRule)
{
if (customRule != null && !this.CustomRules.Any(r => r.RuleName.Equals(customRule.RuleName, StringComparison.OrdinalIgnoreCase)))
if (customRule != null && !this.CustomRules.Any(r => r.RuleUri.ToString().Equals(customRule.RuleUri.ToString(), StringComparison.OrdinalIgnoreCase)))
this.CustomRules.Add(customRule);
return this;
}
Expand Down Expand Up @@ -173,14 +173,14 @@ public RDFOntologyReasonerReport ApplyToOntology(RDFOntology ontology, RDFOntolo
//Custom Rules
Parallel.ForEach(this.CustomRules, rule =>
{
RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Launching custom rule '{0}': {1}", rule.RuleName, rule));
RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Launching custom rule '{0}': {1}", rule.RuleUri, rule));

#region Exec
RDFOntologyReasonerReport customRuleReport = rule.ApplyToOntology(tempOntology, options);
report.Merge(customRuleReport);
#endregion

RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Completed custom rule '{0}': found {1} evidences.", rule.RuleName, customRuleReport.EvidencesCount));
RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Completed custom rule '{0}': found {1} evidences.", rule.RuleUri, customRuleReport.EvidencesCount));
});

RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Reasoner has been applied on Ontology '{0}': found " + report.EvidencesCount + " unique evidences.", ontology.Value));
Expand Down
10 changes: 5 additions & 5 deletions RDFSharp/Semantics/OWL/Reasoner/RDFOntologyReasonerRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ internal static RDFOntologyReasonerReport EquivalentPropertyTransitivity(RDFOnto
}

/// <summary>
/// P(F1,F2) ^ DOMAIN(P,C) -> TYPE(F1,C)
/// P(F1,F2) ^ DOMAIN(P,C) -> C(F1)
/// </summary>
internal static RDFOntologyReasonerReport DomainEntailment(RDFOntology ontology)
{
Expand Down Expand Up @@ -201,7 +201,7 @@ internal static RDFOntologyReasonerReport DomainEntailment(RDFOntology ontology)
}

/// <summary>
/// P(F1,F2) ^ RANGE(P,C) -> TYPE(F2,C)"
/// P(F1,F2) ^ RANGE(P,C) -> C(F2)
/// </summary>
internal static RDFOntologyReasonerReport RangeEntailment(RDFOntology ontology)
{
Expand Down Expand Up @@ -631,7 +631,7 @@ internal static RDFOntologyReasonerReport SameAsEntailment(RDFOntology ontology)
}

/// <summary>
/// C(F1) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASVALUE(R,F2) => P(F1,F2)
/// C(F1) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASVALUE(R,F2) -> P(F1,F2)
/// </summary>
internal static RDFOntologyReasonerReport HasValueEntailment(RDFOntology ontology)
{
Expand Down Expand Up @@ -665,7 +665,7 @@ internal static RDFOntologyReasonerReport HasValueEntailment(RDFOntology ontolog
}

/// <summary>
/// C(F) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASSELF(R,"TRUE") => P(F,F)
/// C(F) ^ SUBCLASS(C,R) ^ RESTRICTION(R) ^ ONPROPERTY(R,P) ^ HASSELF(R,"TRUE") -> P(F,F)
/// </summary>
internal static RDFOntologyReasonerReport HasSelfEntailment(RDFOntology ontology)
{
Expand Down Expand Up @@ -763,7 +763,7 @@ internal static RDFOntologyReasonerReport HasKeyEntailment(RDFOntology ontology)
}

/// <summary>
/// PROPERTYCHAINAXIOM(PCA) ^ MEMBER(PCA,P1) ^ MEMBER(PCA,P2) ^ P1(F1,X) ^ P2(X,F2) => PCA(F1,F2)
/// PROPERTYCHAINAXIOM(PCA) ^ MEMBER(PCA,P1) ^ MEMBER(PCA,P2) ^ P1(F1,X) ^ P2(X,F2) -> PCA(F1,F2)
/// </summary>
internal static RDFOntologyReasonerReport PropertyChainEntailment(RDFOntology ontology)
{
Expand Down

0 comments on commit 64969da

Please sign in to comment.