Christopher Johnson (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252220

Change subject: add param qname to getclaims graphs
......................................................................

add param qname to getclaims graphs

Change-Id: I366931973a0a4141fb79c3dcc76b3a5b9b050a0e
---
M src/model.R
M src/scripts/Rcron.sh
M src/scripts/bulk_sparql.R
M src/scripts/property_usage.R
M src/utils.R
M ui.R
6 files changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/analytics/dashboard 
refs/changes/20/252220/1

diff --git a/src/model.R b/src/model.R
index f3b699c..62f7e55 100644
--- a/src/model.R
+++ b/src/model.R
@@ -23,7 +23,7 @@
   sparql2 <<- get_local_set("spql2.tsv", sparql_data_uri)
   sparql3 <<- get_local_set("spql3.tsv", sparql_data_uri)
   sparql13 <<- get_local_set("spql13.tsv", sparql_data_uri)
-  property_usage_counts <<- get_local_set("prop_usage.tsv", sparql_data_uri)
+  property_usage_counts <<- get_local_set("property_usage.tsv", 
sparql_data_uri)
   return(invisible())
 }
 
diff --git a/src/scripts/Rcron.sh b/src/scripts/Rcron.sh
index dd3d5ab..5e210c1 100755
--- a/src/scripts/Rcron.sh
+++ b/src/scripts/Rcron.sh
@@ -1,3 +1,2 @@
 #! /bin/bash
 R CMD BATCH /srv/dashboards/shiny-server/wdm/src/scripts/bulk_sparql.R
-R CMD BATCH /srv/dashboards/shiny-server/wdm/src/scripts/property_usage.R
diff --git a/src/scripts/bulk_sparql.R b/src/scripts/bulk_sparql.R
index e2693b6..d3312dc 100644
--- a/src/scripts/bulk_sparql.R
+++ b/src/scripts/bulk_sparql.R
@@ -2,7 +2,7 @@
 
 src.path <- "/srv/dashboards/shiny-server/wdm/src/"
 source(paste0(src.path, "config.R"), chdir=T)
-output_path = sparql_data_uri
+output_path = "/srv/dashboards/shiny-server/wdm/data/sparql/"
 qlist <- read_file("/srv/dashboards/shiny-server/wdm/assets/rdfq.xml")
 
 rdfq <- xmlParse(qlist)
diff --git a/src/scripts/property_usage.R b/src/scripts/property_usage.R
index 8003f72..5f61376 100644
--- a/src/scripts/property_usage.R
+++ b/src/scripts/property_usage.R
@@ -1,6 +1,7 @@
 #Bulk Query of WDQS for Property Use Counts and write to TSV
 
 src.path <- "/srv/dashboards/shiny-server/wdm/src/"
+output.path <- "/srv/dashboards/shiny-server/wdm/data/sparql/"
 source(paste0(src.path, "config.R"), chdir=T)
 source(paste0(src.path, "utils.R"), chdir=T)
 
@@ -27,7 +28,14 @@
   dt_join_prop_usage <- dt_join_props[prop_counts]
   dt_join_prop_usage <- dt_join_prop_usage[,.SD,.SDcols=c(1,3,4)]
   dt_join_prop_usage <- setnames(dt_join_prop_usage, 
c("Property","Label","Count"))
-  write.table(dt_join_prop_usage, 
paste0("/srv/dashboards/shiny-server/wdm/data/sparql/",filename), sep = "\t", 
row.names = FALSE)
+  write.table(dt_join_prop_usage, paste0(output.path,filename), sep = "\t", 
row.names = FALSE)
 }
 
+wd_prop_predicates <- c("prop/statement/","prop/statement/value/",
+                        
"prop/reference/","prop/reference/value/","prop/qualifier/",
+                        "prop/qualifier/value/","prop/direct/")
+wd_prop_count_files <- c("property_statement_usage.tsv", 
"property_statement_value_usage.tsv",
+                         "property_reference_usage.tsv", 
"property_reference_value_usage.tsv",
+                         "property_qualifier_usage.tsv", 
"property_qualifier_value_usage.tsv",
+                         "property_direct_usage.tsv")
 write_prop_usage_counts("statement_value_property_usage.tsv", 
"prop/statement/value/")
\ No newline at end of file
diff --git a/src/utils.R b/src/utils.R
index aeed332..c9b6a5a 100644
--- a/src/utils.R
+++ b/src/utils.R
@@ -203,7 +203,8 @@
   dt_getclaims_property <- dt_getclaims_property[,.SD,.SDcols=c(1,3)]
   title_query <- get_property_label_query(params_property)
   pfx <- get_property_label_prefixes()
-  title <- get_sparql_result(wdqs_uri, pfx, title_query)
+  title_doc <- get_sparql_result(wdqs_uri, pfx, title_query)
+  title <- get_dataframe_from_xml_result(title_doc, "//sq:literal")
   return(dygraph(dt_getclaims_property,
                  main = paste0(params_property, " : ", title$text),
                  ylab = "") %>%
diff --git a/ui.R b/ui.R
index 0e1577b..c675d0e 100644
--- a/ui.R
+++ b/ui.R
@@ -30,7 +30,7 @@
              menuSubItem(text = "addUsagesForPage", tabName = 
"wikidata_addUsagesForPage")),
     menuItem(text = "", badgeLabel = "Daily RDF", badgeColor = "red"),
     menuItem(text = "Property Usage", icon = icon("exchange"),
-             menuSubItem(text = "List", tabName = 
"wikidata_property_usage_count")),
+             menuSubItem(text = "/prop/", tabName = 
"wikidata_property_usage_count")),
     menuItem(text = "Queries", icon = icon("question"),
              menuSubItem(text = "Lists", tabName = "wikidata_rdf_queries"),
              menuSubItem(text = "Graphs", tabName = "wikidata_rdf_graphs")),

-- 
To view, visit https://gerrit.wikimedia.org/r/252220
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I366931973a0a4141fb79c3dcc76b3a5b9b050a0e
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/analytics/dashboard
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <christopher.john...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to