-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Imlemented dummy datanode and test for it
- Loading branch information
Andrzej Uszok
committed
Sep 25, 2023
1 parent
dba31f1
commit ecbe94b
Showing
9 changed files
with
233 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Docs
updated
19 files
Submodule Tasks
updated
4 files
+ − | VQA/adj_matrix.pt | |
+23 −1 | VQA/main.py | |
+4 −0 | VQA/model.py | |
+58 −0 | VQA/violations.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from domiknows.graph import Graph, Concept, Relation | ||
from domiknows.graph.logicalConstrain import ifL, andL, nandL, atMostL, existsL | ||
|
||
Graph.clear() | ||
Concept.clear() | ||
Relation.clear() | ||
|
||
with Graph('global') as graph: | ||
with Graph('linguistic') as ling_graph: | ||
char = Concept(name='char') | ||
word = Concept(name='word') | ||
phrase = Concept(name='phrase') | ||
sentence = Concept(name='sentence') | ||
(rel_sentence_contains_word,) = sentence.contains(word) | ||
(rel_sentence_contains_phrase,) = sentence.contains(phrase) | ||
(rel_phrase_contains_word,) = phrase.contains(word) | ||
(rel_word_contains_char,) = word.contains(char) | ||
|
||
pair = Concept(name='pair') | ||
(rel_pair_word1, rel_pair_word2, ) = pair.has_a(arg1=word, arg2=word) | ||
|
||
with Graph('application', auto_constraint=True) as app_graph: | ||
people = word(name='people') | ||
organization = word(name='organization') | ||
location = word(name='location') | ||
other = word(name='other') | ||
o = word(name='O') | ||
|
||
#disjoint(people, organization, location, other, o) | ||
|
||
# LC0 | ||
nandL(people, organization, active = True) | ||
|
||
work_for = pair(name='work_for') | ||
located_in = pair(name='located_in') | ||
live_in = pair(name='live_in') | ||
orgbase_on = pair(name='orgbase_on') | ||
kill = pair(name='kill') | ||
|
||
work_for.has_a(people, organization) | ||
located_in.has_a(location, location) | ||
live_in.has_a(people, location) | ||
orgbase_on.has_a(organization, location) | ||
kill.has_a(people, people) | ||
|
||
# LC2 | ||
ifL(existsL(work_for('x')), andL(people(path=('x', rel_pair_word1.name)), organization(path=('x', rel_pair_word2.name))), active = True) | ||
|
||
# LC3 | ||
ifL(word, atMostL(people, organization, location, other, o), active = True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
from domiknows.graph import createDummyDataNode | ||
from graph import graph | ||
|
||
def test_dummy_data_node_inference(): | ||
testDummyDn = createDummyDataNode(graph) | ||
|
||
# Checking if inferILPResults doesn't raise any exception | ||
try: | ||
testDummyDn.inferILPResults() | ||
except Exception: | ||
pytest.fail("inferILPResults raised an exception") | ||
|
||
# Checking if infer doesn't raise any exception | ||
try: | ||
testDummyDn.infer() | ||
except Exception: | ||
pytest.fail("infer raised an exception") |