Replies: 2 comments 12 replies
-
Initial ideas for basic query use Schema::{User} // import the schema
QUERY GetFollowers(userID: String) => // declare new query
GET Followers <- User(userID)::In::Follows // get all the followers of a user returning the user
WHERE User::Status::Active // filter out followers who are not active
LIMIT 50 // limit the number of followers to 50
RETURN User::{Username, FollowerCount, FollowingCount} // return the username, follower count, and following count of the followers One thing I am unsure about is whether to start the query with something similar to gremlin like doing G::User or V::User to some other way to explicitly show the start of a traversal. Idea for being able to return group together results to be returned as a sub field (thing project by in gremlin) use Schema::{Restaurant};
QUERY GetRestaurantAndReviews(restaurantID: String) =>
GET Res <- Restaurant // same as g.V().as('res')
ADD_FIELD Res { // Access fetched node
Reviews: [ // Define name for new field, square brackets indicate list, curly braces indicate single object
Rating <- InE::Review::Rating // Get the rating from the incoming edge of type Review - Same as Res::InE::Review::Rating
User <- OutV::User // Get the user from the outgoing edge of type User - Same as Rating::OutV::User
]
}
RETURN Res Equivalent gremlin query: g.V(restaurantID).as('Restaurant')
.inE('Review')
.values('Rating').as('Rating')
.outV().as('User')
.project('Restaurant')
.by(
project('Reviews'/* SOME OTHER FIELDS IN HERE FOR REST OF RESTAURANT*/ )
.by(Project('Rating', 'User')
.by(select('Rating'))
.by(
project('Username', 'Email')
.by(select('User').values('Username'))
.by(select('User').values('Email'))
)
)
// MORE PROJECTIONS FOR REST OF RESTAURANT
)
.toList() |
Beta Was this translation helpful? Give feedback.
-
Schema example. Schema would have to be in file called N::User {
Name: String,
Age: Integer,
}
E::Follows{
From: User,
To: User,
Properties{
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion is focussed on the planning of the project. How we will actually implement everything and the approaches we should take.
The initial technical plan is to write everything in Rust. It is a strongly typed and powerful language which I believe to be a good choice for a project such as this.
Beta Was this translation helpful? Give feedback.
All reactions