Skip to content

Commit

Permalink
FR-3305959: Added support for 'none' action Implication.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddossot committed May 31, 2011
1 parent 4edb15c commit 74d2422
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 128 deletions.
Binary file added Misc/NxBRE-Documentation-3_3_0.odt
Binary file not shown.
17 changes: 15 additions & 2 deletions NxBRE3/README.txt
@@ -1,5 +1,11 @@
NxBRE README v3.2.0
===================

_______ _______________________________
\ \ ___ __\______ \______ \_ _____/
/ | \\ \/ /| | _/| _/| __)_
/ | \> < | | \| | \| \
\____|__ /__/\_ \|______ /|____|_ /_______ /
\/ \/ \/ \/ \/


URL : http://nxbre.org
EMail : contact@nxbre.org
Expand All @@ -8,6 +14,13 @@ License : LGPL

## RELEASE NOTES ##

v3.3.0

Inference Engine

* Added support for 'none' action Implication (feature request 3305959).


v3.2.0

General
Expand Down
8 changes: 8 additions & 0 deletions NxBRE3/Rulefiles/test-0_86.hrf
Expand Up @@ -160,6 +160,14 @@ flag{?object, triggeredZ}
balance{?account, actualValue, 25}
-> isTwentyFive{?account};

[label:No Action Implication;action:none;]
noopTrigger{foo}
-> doNotAssert{bar};

[label:No Action Implication Checker;precondition:No Action Implication;]
noopTrigger{foo}
-> noopPreconditioned{OK};

[label:Retracting Implication;action:retract;]
retractionTrigger{?target}
-> toRetract{?target};
Expand Down
44 changes: 43 additions & 1 deletion NxBRE3/Rulefiles/test-0_86.ruleml
Expand Up @@ -962,6 +962,48 @@
</atom>
</_body>
</imp>
<imp>
<_rlab>
<ind>label:No Action Implication;action:none;</ind>
</_rlab>
<_head>
<atom>
<_opr>
<rel>doNotAssert</rel>
</_opr>
<ind>bar</ind>
</atom>
</_head>
<_body>
<atom>
<_opr>
<rel>noopTrigger</rel>
</_opr>
<ind>foo</ind>
</atom>
</_body>
</imp>
<imp>
<_rlab>
<ind>label:No Action Implication Checker;precondition:No Action Implication;</ind>
</_rlab>
<_head>
<atom>
<_opr>
<rel>noopPreconditioned</rel>
</_opr>
<ind>OK</ind>
</atom>
</_head>
<_body>
<atom>
<_opr>
<rel>noopTrigger</rel>
</_opr>
<ind>foo</ind>
</atom>
</_body>
</imp>
<imp>
<_rlab>
<ind>label:Retracting Implication;action:retract;</ind>
Expand Down Expand Up @@ -1261,7 +1303,7 @@
</imp>
<imp>
<_rlab>
<ind>Atom Combination Bug 1346078</ind>
<ind>atom Combination Bug 1346078</ind>
</_rlab>
<_head>
<atom>
Expand Down
42 changes: 42 additions & 0 deletions NxBRE3/Rulefiles/test-0_9.ruleml
Expand Up @@ -952,6 +952,48 @@
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:No Action Implication;action:none;</Ind>
</oid>
<body>
<Atom>
<op>
<Rel>noopTrigger</Rel>
</op>
<Ind>foo</Ind>
</Atom>
</body>
<head>
<Atom>
<op>
<Rel>doNotAssert</Rel>
</op>
<Ind>bar</Ind>
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:No Action Implication Checker;precondition:No Action Implication;</Ind>
</oid>
<body>
<Atom>
<op>
<Rel>noopTrigger</Rel>
</op>
<Ind>foo</Ind>
</Atom>
</body>
<head>
<Atom>
<op>
<Rel>noopPreconditioned</Rel>
</op>
<Ind>OK</Ind>
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:Retracting Implication;action:retract;</Ind>
Expand Down
42 changes: 42 additions & 0 deletions NxBRE3/Rulefiles/test-0_91.ruleml
Expand Up @@ -954,6 +954,48 @@
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:No Action Implication;action:none;</Ind>
</oid>
<body>
<Atom>
<op>
<Rel>noopTrigger</Rel>
</op>
<Ind>foo</Ind>
</Atom>
</body>
<head>
<Atom>
<op>
<Rel>doNotAssert</Rel>
</op>
<Ind>bar</Ind>
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:No Action Implication Checker;precondition:No Action Implication;</Ind>
</oid>
<body>
<Atom>
<op>
<Rel>noopTrigger</Rel>
</op>
<Ind>foo</Ind>
</Atom>
</body>
<head>
<Atom>
<op>
<Rel>noopPreconditioned</Rel>
</op>
<Ind>OK</Ind>
</Atom>
</head>
</Implies>
<Implies>
<oid>
<Ind>label:Retracting Implication;action:retract;</Ind>
Expand Down
4 changes: 2 additions & 2 deletions NxBRE3/Source/AssemblyInfo.cs
Expand Up @@ -7,9 +7,9 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AgilePartner S.A.")]
[assembly: AssemblyProduct("NxBRE")]
[assembly: AssemblyCopyright("Copyright (C) 2003-2009 David Dossot et al.")]
[assembly: AssemblyCopyright("Copyright (C) 2003-2011 David Dossot et al.")]
[assembly: AssemblyTrademark("NxBRE is distributed under the GNU LESSER GENERAL PUBLIC LICENSE.")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.2.0.*")]
[assembly: AssemblyVersion("3.3.0.*")]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("NxBRE-UnitTest")]
14 changes: 11 additions & 3 deletions NxBRE3/Source/InferenceEngine/IEImpl.cs
Expand Up @@ -766,9 +766,8 @@ public sealed class IEImpl:IInferenceEngine {
public IList<IList<Fact>> RunQuery(Query query) {
CheckInitialized();
if (query == null) {
throw new BREException("Query is null or not found.");
throw new BREException("Query is null!");
}

return WM.FB.RunQuery(query);
}

Expand All @@ -788,7 +787,11 @@ public sealed class IEImpl:IInferenceEngine {
/// <param name="queryLabel">The label of the Query to run.</param>
/// <returns>An <code>IList&lt;IList&lt;Fact>></code> containing the results found.</returns>
public IList<IList<Fact>> RunQuery(string queryLabel) {
return RunQuery(QB.Get(queryLabel));
Query query = QB.Get(queryLabel);
if (query == null) {
throw new BREException("No query found for label: " + queryLabel);
}
return RunQuery(query);
}

/// <summary>
Expand Down Expand Up @@ -1113,6 +1116,11 @@ public sealed class IEImpl:IInferenceEngine {
}
}
}
else if (implication.Action == ImplicationAction.None)
{
if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "No Action Implication '" + implication.Label + "' matched: " + processResults.Count);
implicationResultsCount = processResults.Count;
}
else {
throw new BREException("Implication action not supported: " + implication.Action);
}
Expand Down
3 changes: 3 additions & 0 deletions NxBRE3/Source/InferenceEngine/IO/AbstractRuleMLAdapter.cs
Expand Up @@ -413,6 +413,9 @@ protected struct RelationResolution {
case "modify":
action = ImplicationAction.Modify;
break;
case "none":
action = ImplicationAction.None;
break;
default:
throw new BREException("An Implication can not perform the action: " + ip.action);
}
Expand Down
2 changes: 1 addition & 1 deletion NxBRE3/Source/InferenceEngine/Rules/Implication.cs
Expand Up @@ -8,7 +8,7 @@ namespace NxBRE.InferenceEngine.Rules {
/// <summary>
/// The possibile implication actions.
/// </summary>
public enum ImplicationAction {Assert, Retract, Count, Modify};
public enum ImplicationAction {Assert, Retract, Count, Modify, None};

/// <summary>
/// The remarkable implication priorities. Any value between in the [0-100] is valid.
Expand Down
18 changes: 18 additions & 0 deletions NxBRE3/Source/NxBRE.sln
@@ -0,0 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# SharpDevelop 2.2.1.2648
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NxBRE", "NxBRE.csproj", "{C5A2507E-550E-4EEC-B3C2-A278ECB27E30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C5A2507E-550E-4EEC-B3C2-A278ECB27E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5A2507E-550E-4EEC-B3C2-A278ECB27E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5A2507E-550E-4EEC-B3C2-A278ECB27E30}.Release|Any CPU.Build.0 = Release|Any CPU
{C5A2507E-550E-4EEC-B3C2-A278ECB27E30}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions NxBRE3/Test/AssemblyInfo.cs
Expand Up @@ -6,8 +6,8 @@
[assembly: AssemblyDescription("Unit tests for NxBRE")]
[assembly: AssemblyCompany("AgilePartner S.A.")]
[assembly: AssemblyProduct("NxBRE")]
[assembly: AssemblyCopyright("Copyright (C) 2003-2008 David Dossot et al.")]
[assembly: AssemblyCopyright("Copyright (C) 2003-2011 David Dossot et al.")]
[assembly: AssemblyTrademark("NxBRE is distributed under the GNU LESSER GENERAL PUBLIC LICENSE.")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.2.0.*")]
[assembly: AssemblyVersion("3.3.0.*")]
[assembly: CLSCompliant(true)]

0 comments on commit 74d2422

Please sign in to comment.