diff --git a/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image3.png b/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image3.png index 7ae085b..aa83c5c 100644 Binary files a/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image3.png and b/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image3.png differ diff --git a/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image7.png b/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image7.png index ecac56b..277ab1e 100644 Binary files a/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image7.png and b/docs/antora/modules/ROOT/images/user_manual/jupyter_notebook/image7.png differ diff --git a/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_python.adoc b/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_python.adoc index 89ca462..fd5ee89 100644 --- a/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_python.adoc +++ b/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_python.adoc @@ -74,11 +74,10 @@ This query is composed of: * The Select section: responsible for specifying which variables or values are to be retrieved from the dataset. SELECT DISTINCT - ?Lot ?WinnerLegalName - ?WinnerCountryCode - ?AwardedValue - ?AwardedValueCurrency + (SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) + (SUM(?AwardedValue) as ?TotalAwardedValue) + (?AwardedValueCurrency as ?AwardedValueCurrencyURI) * The Where section: used to define the specific patterns and conditions that the data in the dataset must match in order to be included in the query result. In this example we have: @@ -119,13 +118,18 @@ This query is composed of: epo:hasCurrency ?AwardedValueCurrency . +* The Group By section: used to group the results by a specific variable. In the example above group by means that the results will be grouped by the winner legal name and the awarded value currency: + + GROUP BY ?WinnerLegalName ?AwardedValueCurrency + + + The query retrieves: -* Lot URI * The legal name of the winner * The winners country code as URI * The value awarded to winner -* The currency of the awarded value +* The currency of the awarded value as URI The notice publication date and winner legal name language can be changed to create other queries. To do this, change the following section: @@ -150,11 +154,10 @@ PREFIX epo: PREFIX org: PREFIX cccev: SELECT DISTINCT -?Lot ?WinnerLegalName -?WinnerCountryCode -?AwardedValue -?AwardedValueCurrency +(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) +(SUM(?AwardedValue) as ?TotalAwardedValue) +(?AwardedValueCurrency as ?AwardedValueCurrencyURI) WHERE { VALUES ?NoticePublicationDate { "20230905" @@ -177,6 +180,6 @@ WHERE { epo:hasAmountValue ?AwardedValue; epo:hasCurrency ?AwardedValueCurrency . } - +GROUP BY ?WinnerLegalName ?AwardedValueCurrency include::partial$feedback.adoc[] diff --git a/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_r.adoc b/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_r.adoc index 38a9393..02a46e4 100644 --- a/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_r.adoc +++ b/docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_r.adoc @@ -85,11 +85,10 @@ This query is composed of: * The Select section: responsible for specifying which variables or values are to be retrieved from the dataset. SELECT DISTINCT - ?Lot ?WinnerLegalName - ?WinnerCountryCode - ?AwardedValue - ?AwardedValueCurrency + (SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) + (SUM(?AwardedValue) as ?TotalAwardedValue) + (?AwardedValueCurrency as ?AwardedValueCurrencyURI) * The Where section: used to define the specific patterns and conditions that the data in the dataset must match in order to be included in the query result. In this example we have: @@ -130,13 +129,18 @@ This query is composed of: epo:hasCurrency ?AwardedValueCurrency . +* The Group By section: used to group the results by a specific variable. In the example above group by means that the results will be grouped by the winner legal name and the awarded value currency: + + GROUP BY ?WinnerLegalName ?AwardedValueCurrency + + + The query retrieves: -* Lot URI * The legal name of the winner * The winners country code as URI * The value awarded to winner -* The currency of the awarded value +* The currency of the awarded value as URI The notice publication date and winner legal name language can be changed to create other queries. To do this, change the following section: @@ -161,11 +165,10 @@ PREFIX epo: PREFIX org: PREFIX cccev: SELECT DISTINCT -?Lot ?WinnerLegalName -?WinnerCountryCode -?AwardedValue -?AwardedValueCurrency +(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) +(SUM(?AwardedValue) as ?TotalAwardedValue) +(?AwardedValueCurrency as ?AwardedValueCurrencyURI) WHERE { VALUES ?NoticePublicationDate { "20230905" @@ -188,5 +191,7 @@ WHERE { epo:hasAmountValue ?AwardedValue; epo:hasCurrency ?AwardedValueCurrency . } +GROUP BY ?WinnerLegalName ?AwardedValueCurrency + include::partial$feedback.adoc[] \ No newline at end of file diff --git a/docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc b/docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc index 1741aa6..d25cbd6 100644 --- a/docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc +++ b/docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc @@ -69,8 +69,8 @@ WHERE { ) } ?Notice epo:hasPublicationDate ?NoticePublicationDate . - ?Notice epo:announcesRole ?Buyer . - ?Buyer a epo:Winner ; + ?Notice epo:announcesRole ?Winner . + ?Winner a epo:Winner ; epo:playedBy ?Organization . ?Organization epo:hasBusinessSize ?BusinessSize . ?Organization cccev:registeredAddress / epo:hasCountryCode ?CountryCode . @@ -138,7 +138,6 @@ This SPARQL query aims to retrieve information about the winners of procurement The query retrieves: -* Lot URI * Winner Legal Name * Winner Country Code * Lot value awarded to winner @@ -166,11 +165,10 @@ PREFIX epo: PREFIX org: PREFIX cccev: SELECT DISTINCT -?Lot ?WinnerLegalName -?WinnerCountryCode -?AwardedValue -?AwardedValueCurrency +(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) +(SUM(?AwardedValue) as ?TotalAwardedValue) +(?AwardedValueCurrency as ?AwardedValueCurrencyURI) WHERE { VALUES ?NoticePublicationDate { "20230905" @@ -193,6 +191,7 @@ WHERE { epo:hasAmountValue ?AwardedValue; epo:hasCurrency ?AwardedValueCurrency . } +GROUP BY ?WinnerLegalName ?AwardedValueCurrency == Query: Which is the highest value published for a contract award for a given date ? diff --git a/notebooks/query_cellar_R.ipynb b/notebooks/query_cellar_R.ipynb index f966f80..6ad6d95 100644 --- a/notebooks/query_cellar_R.ipynb +++ b/notebooks/query_cellar_R.ipynb @@ -46,14 +46,13 @@ "PREFIX org: \n", "PREFIX cccev: \n", "SELECT DISTINCT\n", - "?Lot\n", "?WinnerLegalName\n", - "?WinnerCountryCode\n", - "?AwardedValue\n", - "?AwardedValueCurrency\n", + "(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI)\n", + "(SUM(?AwardedValue) as ?TotalAwardedValue)\n", + "(?AwardedValueCurrency as ?AwardedValueCurrencyURI)\n", "WHERE {\n", " VALUES ?NoticePublicationDate {\n", - " \"20230905\"\n", + " '20230905'\n", " }\n", " FILTER(LANG(?WinnerLegalName) = 'en')\n", " ?Notice a epo:Notice;\n", @@ -73,6 +72,7 @@ " epo:hasAmountValue ?AwardedValue;\n", " epo:hasCurrency ?AwardedValueCurrency .\n", "}\n", + "GROUP BY ?WinnerLegalName ?AwardedValueCurrency\n", "\"" ] }, diff --git a/queries/SMEs_by_country.rq b/queries/SMEs_by_country.rq index 5b1ef90..f83ce68 100644 --- a/queries/SMEs_by_country.rq +++ b/queries/SMEs_by_country.rq @@ -11,8 +11,8 @@ WHERE { ) } ?Notice epo:hasPublicationDate ?NoticePublicationDate . - ?Notice epo:announcesRole ?Buyer . - ?Buyer a epo:Winner ; + ?Notice epo:announcesRole ?Winner . + ?Winner a epo:Winner ; epo:playedBy ?Organization . ?Organization epo:hasBusinessSize ?BusinessSize . ?Organization cccev:registeredAddress / epo:hasCountryCode ?CountryCode . diff --git a/queries/winners.rq b/queries/winners.rq index 40f1663..1bef1c4 100644 --- a/queries/winners.rq +++ b/queries/winners.rq @@ -4,11 +4,10 @@ PREFIX epo: PREFIX org: PREFIX cccev: SELECT DISTINCT -?Lot ?WinnerLegalName -?WinnerCountryCode -?AwardedValue -?AwardedValueCurrency +(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI) +(SUM(?AwardedValue) as ?TotalAwardedValue) +(?AwardedValueCurrency as ?AwardedValueCurrencyURI) WHERE { VALUES ?NoticePublicationDate { "20230905" @@ -30,4 +29,5 @@ WHERE { ?MonetaryValue a epo:MonetaryValue; epo:hasAmountValue ?AwardedValue; epo:hasCurrency ?AwardedValueCurrency . -} \ No newline at end of file +} +GROUP BY ?WinnerLegalName ?AwardedValueCurrency \ No newline at end of file