Skip to content

Commit f0d8c6b

Browse files
authored
Improve SPARQL Editor ui
1 parent 877c9bc commit f0d8c6b

File tree

5 files changed

+65
-18
lines changed

5 files changed

+65
-18
lines changed

.env.example

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ ALLOWED_ORIGINS=*
1313
CATALOG_FILE=catalog.rdf
1414

1515
# SPARQL Query Configuration
16-
DEFAULT_SPARQL_QUERY="PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nSELECT * WHERE {\n ?s ?p ?o .\n} LIMIT 100"
16+
DEFAULT_SPARQL_QUERY="PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX dct: <http://purl.org/dc/terms/>\nPREFIX dcat: <http://www.w3.org/ns/dcat#>\n\nSELECT DISTINCT ?subject ?label ?type ?description WHERE {\n ?subject rdf:type ?type .\n OPTIONAL { ?subject rdfs:label ?label }\n OPTIONAL { ?subject dct:description ?description }\n} \nORDER BY ?type ?label\nLIMIT 100"
1717
EXAMPLE_SPARQL_QUERIES='{
1818
"HVD info": {
19-
"query": "prefix dct: <http://purl.org/dc/terms/>\nprefix dcatap: <http://data.europa.eu/r5r/>\nprefix dcat: <http://www.w3.org/ns/dcat#>\n\nselect distinct ?title ?hvdCategory ?applicableLegislation ?accessService ?accessURL ?license\nwhere {\n # Filtrar por catálogos ES\n ?catalogo ?cp ?d.\n\n # Dataset y su categoría HVD\n ?d dcatap:applicableLegislation <http://data.europa.eu/eli/reg_impl/2023/138/oj>.\n ?d a dcat:Dataset.\n optional { ?d dcatap:hvdCategory ?hvdCategory. }\n \n # Distribución y sus propiedades\n ?d dcat:distribution ?dist.\n ?dist dcatap:applicableLegislation <http://data.europa.eu/eli/reg_impl/2023/138/oj>.\n \n optional { \n ?dist dct:title ?title.\n FILTER(langMatches(lang(?title), \"es\"))\n } \n optional { ?dist dcatap:applicableLegislation ?applicableLegislation. } \n optional { ?dist dcat:accessURL ?accessURL. } \n optional { ?dist dcat:accessService ?accessService. } \n optional { ?dist dct:license ?license. } \n}\nORDER BY ?dist"
19+
"query": "prefix dct: <http://purl.org/dc/terms/>\nprefix dcatap: <http://data.europa.eu/r5r/>\nprefix dcat: <http://www.w3.org/ns/dcat#>\n\nselect distinct ?title ?hvdCategory ?applicableLegislation ?accessService ?accessURL ?license\nwhere {\n ?catalogo ?cp ?d.\n\n # Dataset y su categoría HVD\n ?d dcatap:applicableLegislation <http://data.europa.eu/eli/reg_impl/2023/138/oj>.\n ?d a dcat:Dataset.\n optional { ?d dcatap:hvdCategory ?hvdCategory. }\n \n # Distribution and its props\n ?d dcat:distribution ?dist.\n ?dist dcatap:applicableLegislation <http://data.europa.eu/eli/reg_impl/2023/138/oj>.\n \n optional { \n ?dist dct:title ?title.\n FILTER(langMatches(lang(?title), \"en\"))\n } \n optional { ?dist dcatap:applicableLegislation ?applicableLegislation. } \n optional { ?dist dcat:accessURL ?accessURL. } \n optional { ?dist dcat:accessService ?accessService. } \n optional { ?dist dct:license ?license. } \n}\nORDER BY ?dist"
2020
},
21-
"Query types": {
22-
"query": "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nSELECT DISTINCT ?type WHERE {\n ?s rdf:type ?type\n} LIMIT 10"
21+
"Count stats": {
22+
"query": "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX dcat: <http://www.w3.org/ns/dcat#>\nPREFIX dct: <http://purl.org/dc/terms/>\n\nSELECT \n (COUNT(DISTINCT ?dataset) AS ?totalDatasets)\n (COUNT(DISTINCT ?distribution) AS ?totalDistributions)\n (COUNT(DISTINCT ?dataservice) AS ?totalDataservices)\n (COUNT(DISTINCT ?publisher) AS ?totalPublishers)\nWHERE {\n {\n ?dataset a dcat:Dataset .\n OPTIONAL { ?dataset dct:publisher ?publisher }\n OPTIONAL { ?dataset dcat:distribution ?distribution }\n }\n UNION\n {\n ?dataservice a dcat:DataService ;\n dcat:servesDataset ?dataset .\n }\n}"
2323
},
24-
"Count triples": {
25-
"query": "SELECT (COUNT(*) AS ?count) WHERE {\n ?s ?p ?o .\n}"
24+
"Query types": {
25+
"query": "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX dct: <http://purl.org/dc/terms/>\nSELECT DISTINCT ?type ?label (COUNT(?s) as ?count) ?comment WHERE {\n ?s rdf:type ?type .\n OPTIONAL { ?type rdfs:label ?label }\n OPTIONAL { ?type rdfs:comment ?comment }\n} \nGROUP BY ?type ?label ?comment\nORDER BY DESC(?count)\nLIMIT 10"
2626
}
2727
}'
2828
SPARQL_ENDPOINT_TITLE="RDF SPARQL Endpoint-Catalog"

easy-rdf-endpoint/setup/rdflib-endpoint/yasgui.html

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
<div class="header-container">
1717
<h1 class="text-primary">SPARQL Search</h1>
1818
<div class="badges-container">
19-
<a href="/catalog" target="_blank" class="badge badge-rdf">
20-
<img src="/img/format/rdf.svg" alt="RDF icon" class="badge-icon">
21-
Download RDF Catalog
19+
<a href="/" target="_self" class="badge badge-home" data-title="Return to homepage">
20+
<img src="/img/home.svg" alt="Home icon" class="badge-icon home-icon">
2221
</a>
23-
<a href="/sparql" target="_blank" class="badge badge-sparql">
22+
<a href="/sparql" target="_blank" class="badge badge-sparql" data-title="Access the machine-readable SPARQL endpoint">
2423
<img src="/img/sparql.svg" alt="SPARQL icon" class="badge-icon">
2524
SPARQL Endpoint
2625
</a>
26+
<a href="/catalog" target="_blank" class="badge badge-rdf" data-title="Download the complete RDF catalog file">
27+
<img src="/img/format/rdf.svg" alt="RDF icon" class="badge-icon">
28+
RDF Catalog
29+
</a>
2730
</div>
2831
</div>
2932
<div class="description">
@@ -38,6 +41,7 @@ <h1 class="text-primary">SPARQL Search</h1>
3841
<code id="endpoint-url" title="Click to copy"></code>
3942
</li>
4043
</ul>
44+
<br>
4145
<p>
4246
To assist users in constructing useful SPARQL queries, the <a href="https://dataeuropa.gitlab.io/data-provider-manual/">European Data Portal (EDP)</a> provide featured
4347
<a href="https://data.europa.eu/about/sparql">sample SPARQL queries </a> that can be executed via our endpoint.

nginx/setup/css/common.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ code#endpoint-url:hover {
9898
}
9999

100100
code#endpoint-url .copy-icon {
101-
width: 25px;
102-
height: 25px;
101+
width: 20px;
102+
height: 20px;
103103
margin: 0 auto;
104104
}
105105

nginx/setup/css/yasgui.css

+48-6
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ hr {
3636
margin-bottom: 2rem;
3737
line-height: 1.6;
3838
}
39+
.yasgui .tabsList .tab.active a {
40+
border-bottom-color: var(--primary-color);
41+
color: var(--primary-color);
42+
font-weight: bold;
43+
}
3944
#yasgui {
4045
width: 100%;
4146
height: 600px;
42-
border: 1px solid #ddd;
43-
border-radius: 4px;
44-
margin-top: 2rem;
45-
}
46-
.yasgui .yasqe {
47-
height: 400px !important;
47+
margin-top: 1rem;
4848
}
4949
.yasgui .yasr {
5050
height: 200px !important;
@@ -85,4 +85,46 @@ hr {
8585
color: #6f6f6f;
8686
font-weight: bold;
8787
font-size: 14px;
88+
}
89+
90+
.badge-home {
91+
background-color: #9da2a740;
92+
color: #6f6f6f;
93+
font-weight: bold;
94+
font-size: 14px;
95+
margin-right: 0;
96+
}
97+
.badge-icon.home-icon {
98+
margin: 0;
99+
padding: 0;
100+
width: 24px;
101+
height: 24px;
102+
}
103+
104+
.badge-home:hover .badge-icon.home-icon {
105+
filter: brightness(10);
106+
}
107+
108+
.badge-home:hover {
109+
background-color: var(--primary-color);
110+
color: white;
111+
}
112+
113+
.badge {
114+
position: relative;
115+
}
116+
117+
.badge[data-title]:hover::after {
118+
content: attr(data-title);
119+
position: absolute;
120+
bottom: -26px;
121+
left: 50%;
122+
transform: translateX(-50%);
123+
padding: 4px 8px;
124+
background-color: rgb(0 49 100 / 40%);
125+
color: var(--primary-color);
126+
border-radius: 10px;
127+
font-size: 12px;
128+
white-space: nowrap;
129+
z-index: 1000;
88130
}

nginx/setup/img/home.svg

+1
Loading

0 commit comments

Comments
 (0)