forked from Pometry/Raphtory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* impl graph static properties graphql api * add more filters * add multiple layers filter to degree * add property_history to node * read files instead of directories from graphql server --------- Co-authored-by: Shivam Kapoor <[email protected]>
- Loading branch information
1 parent
4fa687f
commit c968832
Showing
11 changed files
with
184 additions
and
29 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
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,45 @@ | ||
use crate::model::filters::primitives::{StringFilter, StringVecFilter}; | ||
use crate::model::graph::edge::Edge; | ||
use crate::model::graph::node::Node; | ||
use dynamic_graphql::InputObject; | ||
use raphtory::db::view_api::{EdgeViewOps, VertexViewOps}; | ||
|
||
#[derive(InputObject)] | ||
pub struct EdgeFilter { | ||
node_names: Option<StringVecFilter>, | ||
src: Option<StringFilter>, | ||
dst: Option<StringFilter>, | ||
layer_names: Option<StringVecFilter>, | ||
} | ||
|
||
impl EdgeFilter { | ||
pub(crate) fn matches(&self, edge: &Edge) -> bool { | ||
if let Some(names_filter) = &self.node_names { | ||
let src = edge.ee.src().name(); | ||
let dst = edge.ee.dst().name(); | ||
if !names_filter.contains(&src) || !names_filter.contains(&dst) { | ||
return false; | ||
} | ||
} | ||
|
||
if let Some(name_filter) = &self.src { | ||
if !name_filter.matches(&edge.ee.src().name()) { | ||
return false; | ||
} | ||
} | ||
|
||
if let Some(name_filter) = &self.dst { | ||
if !name_filter.matches(&edge.ee.dst().name()) { | ||
return false; | ||
} | ||
} | ||
|
||
if let Some(name_filter) = &self.layer_names { | ||
if !name_filter.contains(&edge.ee.layer_name()) { | ||
return false; | ||
} | ||
} | ||
|
||
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub(crate) mod nodefilter; | ||
pub(crate) mod primitives; | ||
pub(crate) mod property; | ||
pub(crate) mod edgefilter; |
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
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,13 @@ | ||
use dynamic_graphql::SimpleObject; | ||
|
||
#[derive(SimpleObject)] | ||
pub(crate) struct PropertyUpdate { | ||
pub(crate) time: i64, | ||
pub(crate) value: String, | ||
} | ||
|
||
impl PropertyUpdate { | ||
pub fn new(time: i64, value: String) -> Self { | ||
Self { time, value } | ||
} | ||
} |
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