<jupyter_start><jupyter_text>Europeandataportal.eu Test access SPARQL endpoint<jupyter_code>import sys,json
import pandas as pd
from SPARQLWrapper import SPARQLWrapper, JSON
endpoint_url = "https://www.europeandataportal.eu/sparql"

query = """SELECT * WHERE {
  ?s ?p ?o
}
limit 100"""


def get_sparql_dataframe(endpoint_url, query):
    # print (query)
    user_agent = "user: salgo60/%s.%s" % (sys.version_info[0], sys.version_info[1])
    sparql = SPARQLWrapper(endpoint_url, agent=user_agent)
    sparql.setQuery(query)
    sparql.setReturnFormat(JSON)
    result = sparql.query().convert()
    print(type(result))
    #print(results)
    column_names = ["s", "p", "q"]
    cols = results["head"]
    out = [] 
    for row in processed_results['head']:
        item = [] 
        print (cols)
        for c in cols: 
            print(row)
            item.append(row.get(c, {}).get('value'))
        
        out.append(item) 
    return pd.DataFrame(out, columns=cols)

df = get_sparql_dataframe(endpoint_url, query)<jupyter_output><class 'dict'>
{'link': [], 'vars': ['s', 'p', 'o']}
link
{'fraction_non_alphanumeric': 0.15132178669097537, 'fraction_numerical': 0.006381039197812215, 'mean_word_length': 3.5185185185185186, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '126303', 'license': 'MIT', 'n_tokens_mistral': 408, 'n_tokens_neox': 392, 'n_words': 79, 'path': '.ipynb_checkpoints/Europeandataporta-checkpoint.ipynb', 'repo_name': 'salgo60/open-data-examples', 'size': '1097'}