These rows are parsed, turned into Person nodes, and filled with properties.In this paper we tackle the estimation of apparent age in still face images with deep learning. The second ingest stream matches the movieData.csv file's rows containing Person entities. nodeAppearances : - predicate : dbLabel : Movie propertyKeys : knownValues : Person Nodes ΒΆ standingQueries : - pattern : type : Cypher mode : MultipleValues query : |- MATCH (a:Movie)(m:Movie) WHERE id(a) = id(m) RETURN id(m) as movieId, id(p) as personId outputs : set-ActedDirected : type : CypherQuery query : |- MATCH (m),(p) WHERE id(m) = $ AND id(p) = $ WITH * CREATE (p:Person)->(m:Movie) RETURN id(m) as movieId, m.title as Movie, id(p) as personId, p.name as Actor andThen : type : WriteToFile path : "ActorDirector.jsonl" # Customize node appearance in web UI. This time, we'll work with `CSV` data exported from IMDb to answer the question *"Which actors have acted in and directed the same movie?"* # Ingest Streams connect to data sources and establish how data is processed and transformed ingestStreams : # INGEST-1 - type : FileIngest path : $movie_file format : type : CypherCsv headers : true query : |- WITH $that AS row MATCH (m) WHERE row.Entity = 'Movie' AND id(m) = idFrom("Movie", row.movieId) SET m:Movie, m.tmdbId = row.tmdbId, m.imdbId = row.imdbId, m.imdbRating = toFloat(row.imdbRating), m.released = row.released, m.title = row.title, m.year = toInteger(row.year), m.poster = row.poster, m.runtime = toInteger(row.runtime), m.countries = split(coalesce(row.countries,""), "|"), m.imdbVotes = toInteger(row.imdbVotes), m.revenue = toInteger(row.revenue), m.plot = row.plot, m.url = row.url, m.budget = toInteger(row.budget), m.languages = split(coalesce(row.languages,""), "|"), m.movieId = row.movieId WITH m,split(coalesce(row.genres,""), "|") AS genres UNWIND genres AS genre WITH m, genre MATCH (g) WHERE id(g) = idFrom("Genre", genre) SET g.genre = genre, g:Genre CREATE (m:Movie)->(g:Genre) # INGEST-2 - type : FileIngest path : $movie_file format : type : CypherCsv headers : true query : |- WITH $that AS row MATCH (p) WHERE row.Entity = "Person" AND id(p) = idFrom("Person", row.tmdbId) SET p:Person, p.imdbId = row.imdbId, p.bornIn = row.bornIn, p.name = row.name, p.bio = row.bio, p.poster = row.poster, p.url = row.url, p.born = row.born, p.died = row.died, p.tmdbId = row.tmdbId, p.born = CASE row.born WHEN "" THEN null ELSE datetime(row.born + "T00:00:00Z") END, p.died = CASE row.died WHEN "" THEN null ELSE datetime(row.died + "T00:00:00Z") END # INGEST-3 - type : FileIngest path : $movie_file format : type : CypherCsv headers : true query : |- WITH $that AS row WITH row WHERE row.Entity = "Join" AND row.Work = "Acting" MATCH (p), (m), (r) WHERE id(p) = idFrom("Person", row.tmdbId) AND id(m) = idFrom("Movie", row.movieId) AND id(r) = idFrom("Role", row.tmdbId, row.movieId, row.role) SET r.role = row.role, r.movie = row.movieId, r.tmdbId = row.tmdbId, r:Role CREATE (p:Person)->(r:Role)(m:Movie) # INGEST-4 - type : FileIngest path : $movie_file format : type : CypherCsv headers : true query : |- WITH $that AS row WITH row WHERE row.Entity = "Join" AND row.Work = "Directing" MATCH (p), (m) WHERE id(p) = idFrom("Person", row.tmdbId) AND id(m) = idFrom("Movie", row.movieId) CREATE (p:Person)->(m:Movie) # INGEST-5 - type : FileIngest path : $rating_file format : type : CypherCsv headers : true query : |- WITH $that AS row MATCH (m), (u), (rtg) WHERE id(m) = idFrom("Movie", row.movieId) AND id(u) = idFrom("User", row.userId) AND id(rtg) = idFrom("Rating", row.movieId, row.userId, row.rating) SET u.name = row.name, u:User SET rtg.rating = row.rating, rtg.timestamp = toInteger(row.timestamp), rtg:Rating CREATE (u:User)->(rtg:Rating)(m:Movie) # Standing Queries define how data is transformed and output. # Longer form copy about this Recipe description : |- This recipe is part of the Quine Ingest Stream blog series. # Recipe schema version (currently only supported value is 1 ) version : 1 # Identifies the Recipe but is not necessarily unique or immutable title : Ingesting CSV Files # URL to social profile of the person or organization responsible for this Recipe contributor : # Brief copy about this Recipe summary : |- This recipe takes sample movie and rating data, builds a graph, and alerts when an actor is also the director of a movie.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |