-
Notifications
You must be signed in to change notification settings - Fork 12
Rule Set Classification #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 57 commits
ef65b0f
c268d0c
8b0bc54
ea509cc
79a5051
2769d47
c88f8b7
e8dfe9c
445a003
5b3dd1f
b59a0ce
5510060
29f6a67
063ce25
ef0dc67
61c3802
ed59dda
45f6224
9fb4af2
ecae4a0
73370eb
ddb1b5e
ea5e28f
7fe9dbe
95f6f4a
253851b
5897665
b866160
b2483d6
8e811ce
26e1554
b132bb4
8755ad1
6c8c132
da4b60f
d8bd6af
927d52f
0be4cbd
faa0664
33552e2
4954755
5e6b613
de70506
bdf182e
6f007d5
50e57a2
304a01e
85af7d2
7c8f271
be989b3
49eb764
5c60835
0bdcfdd
219fae9
8def53a
81da690
6a69f0d
3246860
b1b64f9
93e10ab
682f6ae
abae590
29f945d
e15022a
9507583
cd399b9
5d0e89a
a0f6dea
13d7d5f
88597a4
f9ea8ca
5ba8e16
fe9c62b
9eeccde
258b08f
55e63f4
9cd87f6
e97864e
2d45bd8
e3d6a7a
6e4aac1
18e5182
c7af2e9
b854b4b
8ba2964
4e6ec94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ pub mod execution; | |
| pub mod rule_model; | ||
| pub mod util; | ||
|
|
||
| pub mod static_checks; | ||
|
||
|
|
||
| pub mod chase_model; // TODO: Make private | ||
| pub(crate) mod table_manager; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,24 @@ impl Rule { | |
| result | ||
| } | ||
|
|
||
| pub fn positive_variables_as_vec(&self) -> Vec<&Variable> { | ||
|
||
| let mut result = Vec::new(); | ||
|
|
||
| for literal in &self.body { | ||
| if let Literal::Positive(atom) = literal { | ||
| for term in atom.arguments() { | ||
| if let Term::Primitive(Primitive::Variable(variable)) = term { | ||
| if variable.is_universal() && variable.name().is_some() { | ||
| result.push(variable); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| result | ||
| } | ||
|
|
||
| /// Return a set of "safe" variables. | ||
| /// | ||
| /// A variable is considered safe, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ use std::hash::Hash; | |
| pub(crate) type ExternalReference = usize; | ||
|
|
||
| /// Origin of a program component | ||
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] | ||
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] | ||
|
||
| pub enum Origin { | ||
| /// Component was created via a constructor | ||
| Created, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| //! Functionality to give static checks for a RuleSet. | ||
| pub mod acyclicity_graph_constructor; | ||
| pub mod acyclicity_graphs; | ||
| pub mod collection_traits; | ||
| pub mod positions; | ||
| pub mod rule_properties; | ||
| pub mod rule_set; | ||
| pub mod rules_properties; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| //! Functionality that provides methods to build the (JointAcyclicityGraph / WeakAcyclicityGraph) of a | ||
| /// RuleSet. | ||
| use crate::static_checks::acyclicity_graphs::{ | ||
| AcyclicityGraphBuilder, JointAcyclicityGraph, WeakAcyclicityGraph, | ||
| }; | ||
| use crate::static_checks::rule_set::RuleSet; | ||
|
|
||
| /// This Trait provides methods of some RuleSet to build the (WeakAcyclicityGraph / | ||
| /// JointAcyclicityGraph). | ||
| pub trait AcyclicityGraphConstructor<'a> { | ||
| /// Builds the JointAcyclicityGraph. | ||
| fn joint_acyclicity_graph(&'a self) -> JointAcyclicityGraph<'a>; | ||
| /// Builds the WeakAcyclicityGraph. | ||
| fn weak_acyclicity_graph(&'a self) -> WeakAcyclicityGraph<'a>; | ||
| } | ||
|
|
||
| impl<'a> AcyclicityGraphConstructor<'a> for RuleSet { | ||
|
||
| fn joint_acyclicity_graph(&'a self) -> JointAcyclicityGraph<'a> { | ||
| JointAcyclicityGraph::build_graph(self) | ||
| } | ||
|
|
||
| fn weak_acyclicity_graph(&'a self) -> WeakAcyclicityGraph<'a> { | ||
| WeakAcyclicityGraph::build_graph(self) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we would need
assert_cmd.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be removed. I overlooked it somehow.