Skip to content

Instantly share code, notes, and snippets.

@Jotschi
Last active August 29, 2015 14:01
Show Gist options
  • Save Jotschi/20ade72b0c4c9ecb8e8a to your computer and use it in GitHub Desktop.
Save Jotschi/20ade72b0c4c9ecb8e8a to your computer and use it in GitHub Desktop.

KitchenOffice Dummy

This is a dummy gist that kind of represents the data model that is being used in the KitchenOffice Webapp

Console

Dummy Graph

See Cypher Query Language for more information.

CREATE (jotschi:user{name : 'Johannes Schüth'})
CREATE (pep1:user{name : 'Leonard Osang'})
CREATE (nop:user{name : 'Norbert'})
CREATE (berni:user{name : 'Berni'})
CREATE (petro:user{name : 'Petro'})
CREATE (najor:user{name : 'Najor'})

CREATE (maschumaschuEvent:event{description: 'Fetch something to eat from maschumaschu', food_type: 'Israeli food'})
CREATE petro-[:CREATES]->maschumaschuEvent

CREATE (pestoEvent:event{description: 'Cook some pesto', startDate: 1024})
CREATE berni-[:CREATES]->pestoEvent
CREATE najor-[:TAKES_PART]->pestoEvent
CREATE berni-[:TAKES_PART]->pestoEvent
CREATE nop-[:TAKES_PART]->pestoEvent


CREATE (salatEvent:event{description: 'Prepare salat in the office kitchen', startDate: 42})
CREATE jotschi-[:CREATES]->salatEvent
CREATE pep1-[:TAKES_PART]->salatEvent
CREATE jotschi-[:TAKES_PART]->salatEvent

CREATE (office:location{address: 'Gonzagagasse 11/25 - 1010 Wien'})
CREATE salatEvent-[:HAS_LOCATION]->office

CREATE (mixedsalat:recipe{name : 'Generic mixed salat'})
CREATE salatEvent-[:NEEDS_RECIPE]->mixedsalat

CREATE (beans:article{name : 'Steirische Käferbohnen'})
CREATE (tomatoes:article{name : 'Tomaten'})
CREATE (salat:article{name : 'Eisberg Salat'})
CREATE (corn:article{name : 'Mais'})

CREATE beans-[:IS_NEEDED_IN]->mixedsalat
CREATE corn-[:IS_NEEDED_IN]->mixedsalat
CREATE salat-[:IS_NEEDED_IN]->mixedsalat
CREATE tomatoes-[:IS_NEEDED_IN]->mixedsalat


return salatEvent

Use Cases / Queries

Find all attended events for the given user after the given timestamp

@Query("start user=node({0}) "
			+ "match user-[:TAKES_PART]-events "
			+ "where events.startDate > {1} "
			+ "return distinct events "
			+ "order by events.startDate asc")
	public List<Event> findAllAttendedInFutureOf(User user, long date, Pageable Page);
match user-[:TAKES_PART]-event where event.startDate > 41
return distinct event order by event.startDate asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment