Code: Select all
import sparqldataframe
import pandas as pd
# Define the SPARQL query
sparql_query = """
PREFIX dc:
PREFIX epo:
PREFIX cccev:
PREFIX xsd:
PREFIX skos:
PREFIX dcterms:
SELECT DISTINCT ?publicationNumber ?legalName ?publicationDate ?title ?description
?accessURL ?submissionAddress ?procurementDocumentURL ?announcementURL WHERE {
GRAPH ?g {
?notice a epo:Notice ;
epo:hasPublicationDate ?publicationDate ;
epo:hasNoticePublicationNumber ?publicationNumber ;
epo:announcesRole [
a epo:Buyer ;
epo:playedBy [
epo:hasLegalName ?legalName ;
cccev:registeredAddress [
epo:hasCountryCode ?countryUri
]
]
] ;
epo:refersToProcedure [
dcterms:title ?title ;
dcterms:description ?description
] .
OPTIONAL { ?notice dcterms:accessRights ?accessURL . } # Access Rights might not be the correct predicate
OPTIONAL { ?notice dcterms:relation ?submissionAddress . }
OPTIONAL { ?notice epo:hasDocument ?procurementDocumentURL . } # Check if this is the correct predicate
OPTIONAL { ?notice dcterms:isReferencedBy ?announcementURL . } # Use a more relevant predicate for announcement URLs
}
?countryUri a skos:Concept ;
skos:prefLabel "Ireland"@en .
FILTER(CONTAINS(LCASE(STR(?legalName)), "dublin city council"))
}
ORDER BY ?publicationDate
"""
# Execute the SPARQL query
endpoint_url = "https://publications.europa.eu/webapi/rdf/sparql"
df = sparqldataframe.query(endpoint_url, sparql_query)
# Display the results
if not df.empty:
print("Tender Details with URL Fields for Dublin City Council:")
print(df[['publicationNumber', 'legalName', 'publicationDate', 'title', 'description',
'accessURL', 'submissionAddress', 'procurementDocumentURL', 'announcementURL']])
else:
print("No tenders found with URL fields for Dublin City Council.")
[img]https:/ /i.sstatic.net/GUoZbvQE.png[/img]
Ich habe versucht herauszufinden, was der URL-Feldname in Excel-Exporten und Schema-Dokumenten anzeigt, die auf der TED-Website verfügbar sind.
https://docs.ted.europa.eu/ODS/latest/r ... 160219.pdf

Ich kann in den GitHub-Begleitdokumenten kein Codebeispiel finden, das die URL zurückgibt.
https://github.com/OP-TED/ted-rdf -docs/blob/main/notebooks/import-into-dataframe.ipynb