Skip to content

Commit 73203b5

Browse files
committed
change query to return (0,1) instead of (0,0) if predicate or component does not exist (#74)
1 parent 5d8c8c6 commit 73203b5

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

pyreason/scripts/interpretation/interpretation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,18 +739,18 @@ def query(self, query, return_bool=True) -> Union[bool, Tuple[float, float]]:
739739
# Check if the component exists
740740
if comp_type == 'node':
741741
if component not in self.nodes:
742-
return False if return_bool else (0, 0)
742+
return False if return_bool else (0, 1)
743743
else:
744744
if component not in self.edges:
745-
return False if return_bool else (0, 0)
745+
return False if return_bool else (0, 1)
746746

747747
# Check if the predicate exists
748748
if comp_type == 'node':
749749
if pred not in self.interpretations_node[component].world:
750-
return False if return_bool else (0, 0)
750+
return False if return_bool else (0, 1)
751751
else:
752752
if pred not in self.interpretations_edge[component].world:
753-
return False if return_bool else (0, 0)
753+
return False if return_bool else (0, 1)
754754

755755
# Check if the bounds are satisfied
756756
if comp_type == 'node':

pyreason/scripts/interpretation/interpretation_fp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,18 +860,18 @@ def query(self, query, t=0, return_bool=True) -> Union[bool, Tuple[float, float]
860860
# Check if the component exists
861861
if comp_type == 'node':
862862
if component not in self.nodes:
863-
return False if return_bool else (0, 0)
863+
return False if return_bool else (0, 1)
864864
else:
865865
if component not in self.edges:
866-
return False if return_bool else (0, 0)
866+
return False if return_bool else (0, 1)
867867

868868
# Check if the predicate exists
869869
if comp_type == 'node':
870870
if component not in self.interpretations_node[t] or pred not in self.interpretations_node[t][component].world:
871-
return False if return_bool else (0, 0)
871+
return False if return_bool else (0, 1)
872872
else:
873873
if component not in self.interpretations_edge[t] or pred not in self.interpretations_edge[t][component].world:
874-
return False if return_bool else (0, 0)
874+
return False if return_bool else (0, 1)
875875

876876
# Check if the bounds are satisfied
877877
if comp_type == 'node':

0 commit comments

Comments
 (0)