USGCRP / gcis-ontology

Ontology for the Global Change Information System
4 stars 7 forks source link

Generate NCA graphic source report #115

Closed zednis closed 8 years ago

zednis commented 9 years ago

"Calculate how many of the graphics in the NCA3 have source "CICS / NC" or a variation."

congruili commented 9 years ago

could someone please specify what kinds of "variations" would be included? e.g.: Cics Nc Cics / Nc

justgo129 commented 9 years ago

CICS-NC CICS / NC CICS/NC Cooperative Institute for Climate and Satellites — NC Cooperative Institute for Climate and Satellites—NC Cooperative Institute for Climate and Satellites-North Carolina State University Cooperative Institute for Climate and Satellites - North Carolina State University NOAA NCDC / CICS-NC

I think that's it.

congruili commented 9 years ago
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gcis: <http://data.globalchange.gov/gcis.owl#>
PREFIX cito: <http://purl.org/spar/cito/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT
    ?title
    ?figure as ?FigureURL
COUNT (DISTINCT ?figure) as ?Frequency
FROM <http://data.globalchange.gov>
WHERE {
  <http://data.globalchange.gov/report/nca3> gcis:hasFigure ?figure .
  ?figure dcterms:title ?title .
  ?figure gcis:hasCaption ?caption .
  FILTER regex(?caption, "NC")
  OPTIONAL{  ?figure gcis:hasCaption ?caption .
             FILTER regex(?caption, "Cooperative Institute for Climate and Satellites")
  }
} order by ?title

Please correct me in case something is wrong. Thanks!

justgo129 commented 9 years ago

Thanks, @lic10 . I'm not getting any results when trying it in the API though.

zednis commented 9 years ago

@justgo129 the query works for me when I used http://data.globalchange.gov/sparql

http://data.globalchange.gov/sparql?default-graph-uri=&query=PREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+gcis%3A+%3Chttp%3A%2F%2Fdata.globalchange.gov%2Fgcis.owl%23%3E%0D%0APREFIX+cito%3A+%3Chttp%3A%2F%2Fpurl.org%2Fspar%2Fcito%2F%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+dbpprop%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%0D%0APREFIX+prov%3A+%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Fprov%23%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+dcterms%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0A%0D%0ASELECT%0D%0A++++%3Ftitle%0D%0A++++%3Ffigure+as+%3FFigureURL%0D%0ACOUNT+%28DISTINCT+%3Ffigure%29%0D%0AFROM+%3Chttp%3A%2F%2Fdata.globalchange.gov%3E%0D%0AWHERE+%7B%0D%0A++%3Chttp%3A%2F%2Fdata.globalchange.gov%2Freport%2Fnca3%3E+gcis%3AhasFigure+%3Ffigure+.%0D%0A++%3Ffigure+dcterms%3Atitle+%3Ftitle+.%0D%0A++%3Ffigure+gcis%3AhasCaption+%3Fcaption+.%0D%0A++FILTER+regex%28%3Fcaption%2C+%22NC%22%29%0D%0A++OPTIONAL%7B++%3Ffigure+gcis%3AhasCaption+%3Fcaption+.%0D%0A+++++++++++++FILTER+regex%28%3Fcaption%2C+%22Cooperative+Institute+for+Climate+and+Satellites%22%29%0D%0A++%7D%0D%0A%7D+order+by+%3Ftitle&should-sponge=&format=text%2Fhtml&timeout=0&debug=on

justgo129 commented 9 years ago

Interesting. The hyperlink in the e-mail doesn't work, but the one here (identical to that in the e-mail of course) does. I wonder what's going on. @bduggan what are your thoughts?

bduggan commented 9 years ago

I don't know what you mean by "the hyperlink in the email". The SPARQL works for me.

justgo129 commented 9 years ago

Sure. Within the email that is automatically generated with each update of a github issue, I clicked on the URL for the SPARQL query (i.e. the multi-line URL which executes the query). That returns the following syntax error:

\Virtuoso 37000 Error SP030: SPARQL compiler, line 20: syntax error at 'e' before 'dcterm'

SPARQL query: define sql:big-data-const 0

output-format:text/html

define sql:signal-void-variables 1 PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema# PREFIX gcis: http://data.globalchange.gov/gcis.owl# PREFIX cito: http://purl.org/spar/cito/ PREFIX xsd: http://www.w3.org/2001/XMLSchema# PREFIX dbpprop: http://dbpedia.org/property/ PREFIX prov: http://www.w3.org/ns/prov# PREFIX foaf: http://xmlns.com/foaf/0.1/ PREFIX dcterms: http://purl.org/dc/terms/

SELECT ?title ?figure as ?FigureURL COUNT (DISTINCT ?figure) FROM http://data.globalchange.gov WHERE { http://data.globalchange.gov/report/nca3 gcis:hasFigure ?figure . ?figur e dcterm s:title ?title . ?figure gcis:hasCaption ?caption . FILTER regex(?caption, "NC") OPTIONAL{ ?figure gcis:hasCaption ?caption . FILTER regex(?caption, "Cooperative Institute for Climate and Satellites") } } order by ?title

However, clicking on the same hyperlink within the Github UI produces a successful query.

On Tue, Aug 11, 2015 at 5:49 PM, Brian Duggan notifications@github.com wrote:

I don't know what you mean by "the hyperlink in the email". The SPARQL works for me.

— Reply to this email directly or view it on GitHub https://github.com/USGCRP/gcis-ontology/issues/115#issuecomment-130088763 .


Justin Goldstein, Ph.D. Advance Science Climate Data and Observing Systems Coordinator US Global Change Research Program 1717 Pennsylvania Ave NW, Suite #250 Washington, DC 20006

O: (202) 419-3496 M: (202) 285-3005

e-mail: jgoldstein AT usgcrp Dot gov http://www.globalchange.gov

bduggan commented 9 years ago

On Tuesday, August 11, justgo129 wrote:

Sure. Within the email that is automatically generated with each update of a github issue, I clicked on the URL for the SPARQL query (i.e. the multi-line URL which executes the query).

Multi-line URLs are error prone, just copy and paste the SPARQL.

justgo129 commented 9 years ago

Excellent advice, Brian. I am happy with the SPARQL query. Should we revise the column titles for the purpose of aesthetics? I think it's good to go into a test suite. @budggan if you think so , please feel free to close this ticket after adding it if you feel it's ready to go. I'm satisfied with the resolution.

justgo129 commented 9 years ago

Interesting: http://data.globalchange.gov/report/nca3/chapter/appendix-climate-science-supplement/figure/temperature-trends-past-century-past-30-years

comes up as one of the outputs from the SPARQL query. Although an NCDC / CICS product, the description does not explicitly stated "source...CICS" or a variation thereof. From the description, someone not familiar with the figure-making process for the NCA3 may not be sure whether CICS actually designed this figure.

bduggan commented 9 years ago

Anyone want to take a shot at adding this to the test suite?

I've put instructions on how to do this into the README :

https://github.com/USGCRP/gcis-ontology/blob/master/README.md

Brian

justgo129 commented 9 years ago

@lic10 @zednis @xgmachina is there a way to address my comment above (the one beginning with "interesting")? After that, please feel free to add this to the test suite, after which I will close this ticket. Thanks so very much.

congruili commented 9 years ago

I have added this query to the test suite in gcis-sparql.

justgo129 commented 9 years ago

Thanks, @lic10. Could you please inform as to the purpose of the "frequency" column?

justgo129 commented 8 years ago

@zednis @xgmachina could you be of assistance with the question in the previous comment (Sep 1.)? Thanks.

zednis commented 8 years ago

@justgo129 As you can see in the query, Frequency is a count of the occurrences of the figure (by URL). I am not sure why @lic10 added it to the query, but my guess would be he added it since there are multiple figures in the report with the same title (though it appears each occurrence has a unique URL).

My guess is that frequency can be safely removed from the query.

justgo129 commented 8 years ago

@zednis do you feel that this needs to go into a test suite? If not, since it's been added to gcis-sparql, I am happy to close #115.

zednis commented 8 years ago

I do not think it is necessary in the gcis-ontology tests.

zednis commented 8 years ago

@justgo129 please feel free to close.

justgo129 commented 8 years ago

Closed #115.