Skip to content

Commit

Permalink
Merge pull request #14 from OP-TED/feature/TED-1432
Browse files Browse the repository at this point in the history
Feature/ted 1432
  • Loading branch information
duprijil authored Nov 16, 2023
2 parents eba6f57 + 04fcc33 commit 0f16833
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 40 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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:

Expand All @@ -150,11 +154,10 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT DISTINCT
?Lot
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI)
(SUM(?AwardedValue) as ?TotalAwardedValue)
(?AwardedValueCurrency as ?AwardedValueCurrencyURI)
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
Expand All @@ -177,6 +180,6 @@ WHERE {
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency .
}

GROUP BY ?WinnerLegalName ?AwardedValueCurrency

include::partial$feedback.adoc[]
25 changes: 15 additions & 10 deletions docs/antora/modules/ROOT/pages/sample_app/jupyter_notebook_r.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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:

Expand All @@ -161,11 +165,10 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT DISTINCT
?Lot
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI)
(SUM(?AwardedValue) as ?TotalAwardedValue)
(?AwardedValueCurrency as ?AwardedValueCurrencyURI)
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
Expand All @@ -188,5 +191,7 @@ WHERE {
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency .
}
GROUP BY ?WinnerLegalName ?AwardedValueCurrency


include::partial$feedback.adoc[]
13 changes: 6 additions & 7 deletions docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ WHERE {
<http://publications.europa.eu/resource/authority/economic-operator-size/sme>)
}
?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 .
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -166,11 +165,10 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT DISTINCT
?Lot
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI)
(SUM(?AwardedValue) as ?TotalAwardedValue)
(?AwardedValueCurrency as ?AwardedValueCurrencyURI)
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
Expand All @@ -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 ?
Expand Down
10 changes: 5 additions & 5 deletions notebooks/query_cellar_R.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@
"PREFIX org: <http://www.w3.org/ns/org#>\n",
"PREFIX cccev: <http://data.europa.eu/m8g/>\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",
Expand All @@ -73,6 +72,7 @@
" epo:hasAmountValue ?AwardedValue;\n",
" epo:hasCurrency ?AwardedValueCurrency .\n",
"}\n",
"GROUP BY ?WinnerLegalName ?AwardedValueCurrency\n",
"\""
]
},
Expand Down
4 changes: 2 additions & 2 deletions queries/SMEs_by_country.rq
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ WHERE {
<http://publications.europa.eu/resource/authority/economic-operator-size/sme>)
}
?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 .
Expand Down
10 changes: 5 additions & 5 deletions queries/winners.rq
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT DISTINCT
?Lot
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
(SAMPLE(?WinnerCountryCode) as ?WinnereCountryCodeURI)
(SUM(?AwardedValue) as ?TotalAwardedValue)
(?AwardedValueCurrency as ?AwardedValueCurrencyURI)
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
Expand All @@ -30,4 +29,5 @@ WHERE {
?MonetaryValue a epo:MonetaryValue;
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency .
}
}
GROUP BY ?WinnerLegalName ?AwardedValueCurrency

0 comments on commit 0f16833

Please sign in to comment.