User Tools

Site Tools


hollywood_social_network_analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
hollywood_social_network_analysis [2019/09/15 14:11] hkimscilhollywood_social_network_analysis [2019/12/11 08:09] (current) hkimscil
Line 43: Line 43:
      FILTER(LANG(?movie) = "en")      FILTER(LANG(?movie) = "en")
      ?m dbp:released ?movie_date .      ?m dbp:released ?movie_date .
-     FILTER(DATATYPE(?movie_date) xsd:date)+     FILTER(xsd:date(?movie_date) > "1900-01-01"^^xsd:date)
      ?m dbp:starring ?a .      ?m dbp:starring ?a .
      ?a rdfs:label ?actor .      ?a rdfs:label ?actor .
Line 52: Line 52:
    }')    }')
  
-Sys.setenv(TZ = "UTC") 
 res <- SPARQL(endpoint,q,ns=prefix,extra=options)$results res <- SPARQL(endpoint,q,ns=prefix,extra=options)$results
 +head(res)
 +</code>
  
-res</code> +<code>> head(res) 
-<code+                     actor                        movie               director 
-# output: +1 "Pat O'Brien (actor)"@en "Flying High (1931 film)"@en   "Charles Reisner"@en 
-#                   actor                  movie          director movie_date +            "Tom Mix"@en         "The Feud (film)"@en    "Edward LeSaint"@en 
-1 "Harland Williams"@en "Big Money Hustlas"@en "John Cafiero"@en  993506400 +      "Jaime Pressly"@en      "Ticker (2001 film)"@en       "Albert Pyun"@en 
-  "Jamie Spaniolo"@en "Big Money Hustlas"@en "John Cafiero"@en  993506400 + "Kevin Gage (actor)"@en      "Ticker (2001 film)"@en       "Albert Pyun"@en 
-    "Paul Methric"@en "Big Money Hustlas"@en "John Cafiero"@en  993506400 +      "Jimmy Durante"@en        "Roadhouse Nights"@en     "Hobart Henley"@en 
-   "Joseph Utsler"@en "Big Money Hustlas"@en "John Cafiero"@en  993506400 +6        "Rex Harrison"@en  "Doctor Dolittle (film)"@en "Richard Fleischer"@en 
-  "Rudy Ray Moore"@en "Big Money Hustlas"@en "John Cafiero"@en  993506400 +   movie_date 
-# ...</code>+1 -1203379200 
 +2 -1580083200 
 +3  1005609600 
 +4  1005609600 
 +5 -1257724800 
 +6   -64886400
  
 +</code>
  
 <code>res$movie_date <- as.Date(as.POSIXct(res$movie_date,origin="1970-01-01")) <code>res$movie_date <- as.Date(as.POSIXct(res$movie_date,origin="1970-01-01"))
 +head(res)
 </code> </code>
  
-<code># output: +<code> 
-#                   actor                  movie          director movie_date +> head(res) 
-1 "Harland Williams"@en "Big Money Hustlas"@en "John Cafiero"@en 2001-06-25 +                     actor                        movie               director 
-  "Jamie Spaniolo"@en "Big Money Hustlas"@en "John Cafiero"@en 2001-06-25 +1 "Pat O'Brien (actor)"@en "Flying High (1931 film)"@en   "Charles Reisner"@en 
-    "Paul Methric"@en "Big Money Hustlas"@en "John Cafiero"@en 2001-06-25 +            "Tom Mix"@en         "The Feud (film)"@en    "Edward LeSaint"@en 
-   "Joseph Utsler"@en "Big Money Hustlas"@en "John Cafiero"@en 2001-06-25 +      "Jaime Pressly"@en      "Ticker (2001 film)"@en       "Albert Pyun"@en 
-  "Rudy Ray Moore"@en "Big Money Hustlas"@en "John Cafiero"@en 2001-06-25 + "Kevin Gage (actor)"@en      "Ticker (2001 film)"@en       "Albert Pyun"@en 
-# ...+      "Jimmy Durante"@en        "Roadhouse Nights"@en     "Hobart Henley"@en 
 +6        "Rex Harrison"@en  "Doctor Dolittle (film)"@en "Richard Fleischer"@en 
 +  movie_date 
 +1 1931-11-14 
 +2 1919-12-07 
 +2001-11-13 
 +4 2001-11-13 
 +5 1930-02-23 
 +6 1967-12-12 
 +
 </code> </code>
  
 +<code>
 +# write the data somewhere else
 +write.csv(res, file="hollywood_movie_sna_data.csv")
 +getwd()
 +</code>
 +
 +<code>
 +actor_movie_matrix[849:853,3:7]  # just a little sample of the matrix
 +</code>
 +
 +<code>
 +> actor_movie_matrix[849:853,3:7]  # just a little sample of the matrix
 +                                       
 +                                        "Mission: Impossible <e2>\u0080<93> Ghost Protocol"@en "The Hunger Games: Mockingjay <e2>\u0080<93> Part 2"@en
 +  "William Russell (American actor)"@en                                                      0                                                       0
 +  "William Schallert"@en                                                                                                                           0
 +  "Willow Shields"@en                                                                        0                                                       1
 +  "Woody Harrelson"@en                                                                                                                             1
 +  "Wynne Gibson"@en                                                                          0                                                       0
 +                                       
 +                                        "The Hunger Games: Mockingjay <e2>\u0080<93> Part 1"@en "Species <e2>\u0080<93> The Awakening"@en "$1,000 Reward"@en
 +  "William Russell (American actor)"@en                                                                                                                0
 +  "William Schallert"@en                                                                      0                                                          0
 +  "Willow Shields"@en                                                                                                                                  0
 +  "Woody Harrelson"@en                                                                        1                                                          0
 +  "Wynne Gibson"@en                                                                                                                                    0
 +
 +</code>
  
hollywood_social_network_analysis.1568524300.txt.gz · Last modified: 2019/09/15 14:11 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki