Skip to content

Commit

Permalink
Merge pull request #9 from OP-TED/feature/TED-1430
Browse files Browse the repository at this point in the history
Updates according to feedback
  • Loading branch information
duprijil authored Oct 24, 2023
2 parents 8667db8 + f17fae8 commit 3304524
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 61 deletions.
76 changes: 43 additions & 33 deletions docs/antora/modules/ROOT/pages/sample_app/sparql_queries.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ The data available covers Contract Award Notices published after 28/08/2023. Da

A query is submitted to the SPARQL end point by replacing the text highlighted below in blue in the Query Text box below with your query:

image:sparql.png[SPARQL End Point]
.End point user interface
image::sparql.png[SPARQL End Point]

The format of the result can be changed using the drop down box of the Results format.
The format of the result can be changed using the drop-down box of the Results format.



Expand Down Expand Up @@ -138,23 +139,27 @@ This SPARQL query aims to retrieve information about the winners of procurement

The query retrieves:

* Notice ID
* Procedure ID
* Notice publication date
* Lot Number (optional, may be missing as it not specified in notice)
* The legal name of the winner
* The winners country code as URI
* The value awarded to winner
* Lot value awarded to winner
* The currency of the awarded value
* Lot URI
* Notice URI

The notice publication date and winner legal name language can be changed to create other queries. To do this, change the following section:

VALUES ?NoticePublicationDate {
"20230921"
"20230831"
}
FILTER(LANG(?WinnerLegalName) = 'en')

* Existing value for publication date in example above:

"20230921"
"20230831"

* Existing value for winner legal name language in example above:

Expand All @@ -167,23 +172,29 @@ 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
?NoticeID
?NoticePublicationDate
?ProcedureNr
?LotNr
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
?LotAwardedValue
?LotAwardedValueCurrency
?LotURI
?NoticeURI
WHERE {
VALUES ?NoticePublicationDate {
"20230921"
"20230831"
}
FILTER(LANG(?WinnerLegalName) = 'en')
?NoticeId a epo:ResultNotice;
epo:hasPublicationDate ?NoticePublicationDate;
epo:refersToLot ?Lot.
?Lot a epo:Lot.
?LotAwardOutcome epo:describesLot ?Lot;
?NoticeURI a epo:ResultNotice;
epo:hasPublicationDate ?NoticePublicationDate;
epo:hasID / epo:hasIdentifierValue ?NoticeID ;
epo:refersToLot ?LotURI.
?LotURI a epo:Lot.
?LotAwardOutcome epo:describesLot ?LotURI;
a epo:LotAwardOutcome;
epo:hasAwardedValue ?LotAwardedValueURI ;
epo:comprisesTenderAwardOutcome ?TenderAwardOutcome.
?TenderAwardOutcome a epo:TenderAwardOutcome;
epo:indicatesAwardOfLotToWinner / epo:playedBy ?Winner.
Expand All @@ -192,16 +203,15 @@ WHERE {
OPTIONAL {
?Winner cccev:registeredAddress / epo:hasCountryCode ?WinnerCountryCode.
}
?LotAwardOutcome epo:hasAwardedValue ?LotAwardedValue.
?LotAwardedValue a epo:MonetaryValue;
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency.
OPTIONAL {
?Lot epo:hasID / epo:hasIdentifierValue ?LotNr .
}
?Procedure epo:hasProcurementScopeDividedIntoLot ?Lot;
a epo:Procedure ;
epo:hasID / epo:hasIdentifierValue ?ProcedureNr .
?LotAwardedValueURI a epo:MonetaryValue;
epo:hasAmountValue ?LotAwardedValue;
epo:hasCurrency ?LotAwardedValueCurrency.
OPTIONAL {
?LotURI epo:hasID / epo:hasIdentifierValue ?LotNr .
}
?ProcedureURI epo:hasProcurementScopeDividedIntoLot ?LotURI;
a epo:Procedure ;
epo:hasID / epo:hasIdentifierValue ?ProcedureNr .
}


Expand All @@ -215,7 +225,7 @@ The query retrieves:
* Lot URI
* The legal name of the winner
* The winners country code as URI
* The value awarded to winner
* Lot value awarded to winner
* The currency of the awarded value

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 @@ -240,19 +250,19 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT
?Lot
?LotURI
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
?LotAwardedValue
?LotAwardedValueCurrency
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
"20230921"
}
FILTER(LANG(?WinnerLegalName) = 'en')
?Notice epo:hasPublicationDate ?NoticePublicationDate ;
epo:refersToLot ?Lot .
?LotAwardOutcome epo:describesLot ?Lot ;
epo:refersToLot ?LotURI .
?LotAwardOutcome epo:describesLot ?LotURI ;
epo:hasAwardedValue ?MonetaryValue ;
epo:comprisesTenderAwardOutcome ?TenderAwardOutcome.
?TenderAwardOutcome a epo:TenderAwardOutcome;
Expand All @@ -263,10 +273,10 @@ WHERE {
?Winner cccev:registeredAddress / epo:hasCountryCode ?WinnerCountryCode.
}
?MonetaryValue a epo:MonetaryValue;
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency .
epo:hasAmountValue ?LotAwardedValue;
epo:hasCurrency ?LotAwardedValueCurrency .
}
ORDER BY DESC(?AwardedValue)
ORDER BY DESC(?LotAwardedValue)
LIMIT 1

////
Expand Down
20 changes: 10 additions & 10 deletions queries/highest_value_of_contract.rq
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ PREFIX epo: <http://data.europa.eu/a4g/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX cccev: <http://data.europa.eu/m8g/>
SELECT
?Lot
?LotURI
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
?LotAwardedValue
?LotAwardedValueCurrency
WHERE {
VALUES ?NoticePublicationDate {
"20230905"
"20230921"
}
FILTER(LANG(?WinnerLegalName) = 'en')
?Notice epo:hasPublicationDate ?NoticePublicationDate ;
epo:refersToLot ?Lot .
?LotAwardOutcome epo:describesLot ?Lot ;
epo:refersToLot ?LotURI .
?LotAwardOutcome epo:describesLot ?LotURI ;
epo:hasAwardedValue ?MonetaryValue ;
epo:comprisesTenderAwardOutcome ?TenderAwardOutcome.
?TenderAwardOutcome a epo:TenderAwardOutcome;
epo:indicatesAwardOfLotToWinner / epo:playedBy ?Winner.
?Winner a org:Organization;
epo:hasLegalName ?WinnerLegalName .
OPTIONAL {
OPTIONAL {
?Winner cccev:registeredAddress / epo:hasCountryCode ?WinnerCountryCode.
}
?MonetaryValue a epo:MonetaryValue;
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency .
epo:hasAmountValue ?LotAwardedValue;
epo:hasCurrency ?LotAwardedValueCurrency .
}
ORDER BY DESC(?AmmountValue)
ORDER BY DESC(?LotAwardedValue)
LIMIT 1
41 changes: 23 additions & 18 deletions queries/winners.rq
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@ 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
?NoticeID
?NoticePublicationDate
?ProcedureNr
?LotNr
?WinnerLegalName
?WinnerCountryCode
?AwardedValue
?AwardedValueCurrency
?LotAwardedValue
?LotAwardedValueCurrency
?LotURI
?NoticeURI
WHERE {
VALUES ?NoticePublicationDate {
"20230921"
"20230831"
}
FILTER(LANG(?WinnerLegalName) = 'en')
?NoticeId a epo:ResultNotice;
epo:hasPublicationDate ?NoticePublicationDate;
epo:refersToLot ?Lot.
?Lot a epo:Lot.
?LotAwardOutcome epo:describesLot ?Lot;
?NoticeURI a epo:ResultNotice;
epo:hasPublicationDate ?NoticePublicationDate;
epo:hasID / epo:hasIdentifierValue ?NoticeID ;
epo:refersToLot ?LotURI.
?LotURI a epo:Lot.
?LotAwardOutcome epo:describesLot ?LotURI;
a epo:LotAwardOutcome;
epo:hasAwardedValue ?LotAwardedValueURI ;
epo:comprisesTenderAwardOutcome ?TenderAwardOutcome.
?TenderAwardOutcome a epo:TenderAwardOutcome;
epo:indicatesAwardOfLotToWinner / epo:playedBy ?Winner.
Expand All @@ -29,14 +35,13 @@ WHERE {
OPTIONAL {
?Winner cccev:registeredAddress / epo:hasCountryCode ?WinnerCountryCode.
}
?LotAwardOutcome epo:hasAwardedValue ?LotAwardedValue.
?LotAwardedValue a epo:MonetaryValue;
epo:hasAmountValue ?AwardedValue;
epo:hasCurrency ?AwardedValueCurrency.
OPTIONAL {
?Lot epo:hasID / epo:hasIdentifierValue ?LotNr .
}
?Procedure epo:hasProcurementScopeDividedIntoLot ?Lot;
a epo:Procedure ;
epo:hasID / epo:hasIdentifierValue ?ProcedureNr .
?LotAwardedValueURI a epo:MonetaryValue;
epo:hasAmountValue ?LotAwardedValue;
epo:hasCurrency ?LotAwardedValueCurrency.
OPTIONAL {
?LotURI epo:hasID / epo:hasIdentifierValue ?LotNr .
}
?ProcedureURI epo:hasProcurementScopeDividedIntoLot ?LotURI;
a epo:Procedure ;
epo:hasID / epo:hasIdentifierValue ?ProcedureNr .
}

0 comments on commit 3304524

Please sign in to comment.