Die Beschaffungs-URL mithilfe einer SPARQL-Abfrage aus TED extrahieren?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Die Beschaffungs-URL mithilfe einer SPARQL-Abfrage aus TED extrahieren?

by Guest » 31 Dec 2024, 16:08

Ich versuche, die SPARQL-Abfrage zu verwenden, um die Beschaffungs-URL oder die Etenders-Ressourcen-ID von TED abzurufen

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.")
Dies ist das Ergebnis, das ich bisher erhalten habe:
[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
Image

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

Top