Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d69ad40
Create ReasoningController
AmrLamei Apr 7, 2022
1863a73
Delete ReasoningController
AmrLamei Apr 7, 2022
a90c441
Create reasoning_controller
AmrLamei Apr 7, 2022
f297669
Update reasoning_controller
AmrLamei Apr 7, 2022
be79bcc
Add files via upload
AmrLamei Apr 28, 2022
5e9a88c
Add files via upload
AmrLamei Apr 28, 2022
188dd52
Add files via upload
AmrLamei May 12, 2022
37940fb
Add files via upload
AmrLamei May 12, 2022
3c83720
Merge pull request #1 from AmrLamei/AmrLamei-patch-1
AmrLamei May 12, 2022
716f194
Delete code/core/modules/ReasoningController directory
AmrLamei May 12, 2022
4b80cf2
Create As
AmrLamei May 12, 2022
a6d7a84
Add files via upload
AmrLamei May 12, 2022
875b838
Merge pull request #2 from AmrLamei/2nd-Commit
AmrLamei May 12, 2022
43bf1db
Delete As
AmrLamei May 12, 2022
a0e491d
Add files via upload
AmrLamei May 12, 2022
a19a5c0
Second Commit
AmrLamei May 12, 2022
ae0eb3e
Create test
AmrLamei May 12, 2022
675ed8f
Delete test
AmrLamei May 12, 2022
7bd64e4
Create test
AmrLamei May 12, 2022
6d09f64
commit-v2
AmrLamei May 12, 2022
295b1ef
Delete code/core/modules/ReasoningController/code/core/modules directory
AmrLamei May 12, 2022
302e96f
commit-v3
AmrLamei May 26, 2022
08f0546
commit-v3
AmrLamei Jun 2, 2022
ac59f27
commit-v3
AmrLamei Jun 2, 2022
03b7463
Merge branch 'main' of https://github.com/AmrLamei/MindGRAF1.0
AmrLamei Jun 2, 2022
69e47b1
Update Channel.py
AmrLamei Jun 2, 2022
9ab3de4
Update ReasoningController.py
AmrLamei Jun 2, 2022
f2d5328
Update ReasoningController.py
AmrLamei Jun 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Bindings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Bindings():

def __init__(self):
pass
def getBinding():
pass
82 changes: 82 additions & 0 deletions Channel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
from Filter import Filter
from Proposition import Proposition
from ReportSet import ReportSet
from Switch import Switch
import ChannelType
from Substitutions import Substitutions
from Node import Node
from Context import Context
from Report import Report

class Channel:
global count
count = 0
global filter
filter: Filter
global switch
switch: Switch
global reportBuffer
reportBuffer: ReportSet

def __init__ (self,id,source: Node,destination: Node,status: bool ,type: str ,context: Context):
self.id = count
self.source = source
self.destination = destination
self.status = status
self.type = type
self.context = context
count +1

def reportToSend(self,report: Report):
canPass = filter.canPass(report)
if canPass: # and isSupported(report)
Switch.switchReport(report)
requester = self.getSource()
Proposition.recieveReport(self)
self.getReportsBuffer().addReport(report)
return True

return False


def getId(self):
return self.id

def setSubstitution(self,substitution: Substitutions):
self.substitution = substitution

def getSupport(self):
return self.support

def getFilter(self):
return self.filter

def getType(self):
return self.type

def setFilter(self,filter: Filter):
self.filter = filter

def getDestination(self):
return self.destination

def setDestination(self,destination: Node):
self.destination = destination

def getSource(self):
return self.source

def setSource(self,source: Node):
self.source = source

def setReportsBuffer(self,reportsBuffer: ReportSet):
self.reportsBuffer = reportBuffer

def getReportsBuffer():
return reportBuffer

def clearReportsBuffer(self,reportsBuffer: ReportSet):
self.getReportsBuffer().clearReports()

def getContext(self):
return self.context
Binary file added Channel.pyc
Binary file not shown.
45 changes: 45 additions & 0 deletions ChannelSet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from Channel import Channel
from Filter import Filter
from Switch import Switch
from Node import Node
import ChannelType
class ChannelSet(Channel):

def __init__(channel: Channel,id,filter: Filter ,switch: Switch,source: Node ,destination: Node,status: bool,type):
global channels
super().__init__(id,filter,switch,source,destination,status,type)
MatchedChannels = {
'Matched' : channel
}
AntToRuleChannels = {
'AntToRule' : channel
}
RuletoConsChannels = {
'RuleToCons' : channel
}

def addChannel(channel: Channel):
channelSourceId = channel.source.id
channelDestinationId= channel.destination.id
filtersubs = channel.filter.substitutions
switchsubs = channel.channel.substitutions
channelType = channel.getChannelType(channel)

def removeChannel(channel: Channel):
channelSourceId = channel.source.id
channelDestinationId= channel.destination.id
filtersubs = channel.filter.substitutions
switchsubs = channel.channel.substitutions
channelType = channel.getChannelType(channel)

def getChannelType(channel: Channel):
channeltype =''
if (ChannelType.RULEANT):
channeltype = 'AntecedentToRule Channel'
if (ChannelType.RULECONS):
channeltype = 'RuleToConsequent Channel'
else:
channeltype = 'Matched Channel'
return channeltype
#x=ChannelSet(0,0,0,0,0,0,0)
#print(x.getChannelType())
5 changes: 5 additions & 0 deletions ChannelType.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from enum import Enum
class ChannelType(Enum):
MATCHED = 1
RULEANT = 2
RULECONS = 3
Binary file added ChannelType.pyc
Binary file not shown.
21 changes: 21 additions & 0 deletions Filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from Report import Report
from Bindings import Bindings
from Substitutions import Substitutions
class Filter:

def __init__(self,report: Report):
self.report = report

def canPass(self,report: Report,attitude: str):
for x in self.substitution.cardinality():
currentFilterBinding: Bindings
currentFilterBinding = Substitutions.getBinding(x)
currentReportBinding: Bindings
currentReportBinding = report.getSubstitutions().getBindingByVariable(currentFilterBinding.getVariable())
print("Bindings " + currentFilterBinding + " " + report.getSubstitutions())
if (currentReportBinding is not None and currentFilterBinding.getNode() is not currentReportBinding.getNode() and report.attitude is not attitude) :
return False
return True
#x = Filter(1)
#print(x.canPass())

Binary file added Filter.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions Instance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Instance():
def __init__():
pass
34 changes: 34 additions & 0 deletions KnownInstances.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from Report import Report
from ReportSet import reportSet
from Substitutions import Substitutions
from Substitutions import Substitutions
from supportSet import supportSet
from Node import Node


class KnownInstances(Report):
global knowninstances
knowninstances = {
'Substitutions' : reportSet
}

def __init__(self,substitution: Substitutions, support: supportSet ,source: Node ,destination: Node,attitude: str):
super.__init__(substitution, support,source,destination,attitude)


def addReport(self,report: Report):
reportSubs: Substitutions
reportSubs = report
report.getSubstitution()
reportSet = self.pop(reportSubs)
if reportSet == None:
reportSet = []
reportSet.append(report)
self.update(reportSubs,reportSet)


def getReportBySubs(self):
return self.getSubstitution()

def getSubstitution(self,report: Report):
pass
7 changes: 7 additions & 0 deletions Matcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Matcher():
def __init__(self) -> None:
pass
def Match():
pass
def getMatchType():
pass
5 changes: 5 additions & 0 deletions MindGRAFController.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MindGRAFController():
def __init__(self) -> None:
pass
def getContextName():
pass
5 changes: 5 additions & 0 deletions NodeSet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class NodeSet():
def __init__(self) -> None:
pass
def getDownAnt():
pass
39 changes: 39 additions & 0 deletions Proposition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from concurrent.futures import process
from Channel import Channel
from ChannelSet import ChannelSet
from ReasoningController import ReasoningController
from Runner import Runner


import ChannelSet
import supportSet
class Proposition(Entity):
global outgoingChannels
outgoingChannels: ChannelSet
global incomingChannels
incomingChannels: ChannelSet
global supports
supports: supportSet


def __init__(self,outgoingChannels: ChannelSet,incomingChannels: ChannelSet,supports: supportSet):
self.outgoingChannels = outgoingChannels
self.incomingChannels = incomingChannels
self.supports = supports


def processReports():
for x in incomingChannels:
ReasoningController.ProcessReportChannel(x)

def recieveReport(self,channel: Channel):
Runner.addToHighQ(channel)

def addToOutgoingChannels(self, channel: Channel):
outgoingChannels.addChannel(channel)

def addToIncomingChannels(self, channel: Channel):
incomingChannels.addChannel(channel)


#Attributes class (supportSet, channelSet)
9 changes: 9 additions & 0 deletions PropositionSet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PropositionSet():

propositions = {}

def __init__(self) -> None:
pass

def addProp(node: Node):
PropositionSet.propositions.add(node)
Loading