Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install Hugo
run: |
HUGO_VERSION=0.148.1 # Update if needed
HUGO_VERSION=0.152.2 # Update if needed
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
tar -xvzf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
sudo mv hugo /usr/local/bin/hugo
Expand Down
9 changes: 9 additions & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ sections:
# TODO here also other services could be linked which you provide, e.g. a hub or the documentation


- block: markdown
content:
title: Interoperability of Knowledge Graphs
subtitle:
text: |
Interoperability is crucial in the context of Knowledge graphs because it enables seamless data integration, exchange, and reuse across different systems, domains, and organizations. By adhering to established standards, such as those for representation (RDF, Labelled Property Graphs, etc.), or querying (SPARQL, Graph Query Language, etc.), interoperable KGs ensure that diverse datasets can be linked and understood in a unified way, reducing data silos, and enhancing discoverability. In the following report, we provide an overview and best practices on such standards and practices by focusing on metadata mapping, linking, and integration: [https://zenodo.org/records/15780729](https://zenodo.org/records/15780729)
design:
columns: '1'


# - block: markdown
# content:
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/wowchemy/starter-hugo-research-group

go 1.15
go 1.25.3

require (
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20241012174104-661cadc17327
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.1 // indirect
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.3.1 // indirect
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.4.1 // indirect
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.5.2 // indirect
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.3.1 // indirect
)
126 changes: 1 addition & 125 deletions layouts/shortcodes/query_kgreg_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,7 @@
<link rel="stylesheet" href="/css/dataTables.dataTables.min.css">
<script src="/js/jquery-3.7.1.min.js" crossorigin="anonymous"></script>
<script src="/js/dataTables.min.js"></script>
<script>
const sparqlQuery = `PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?dataset ?title ?description
(GROUP_CONCAT(DISTINCT ?publisher; separator=", ") AS ?publishers)
(GROUP_CONCAT(DISTINCT ?publisherName; separator=", ") AS ?publisherNames)
WHERE {
# Basic dataset metadata
?dataset a dcat:Dataset ;
dcterms:title ?title ;
dcterms:publisher ?publisher .

# Optional description
OPTIONAL { ?dataset dcterms:description ?description }

# Local English labels (if available)
OPTIONAL {
?publisher rdfs:label ?publisherNameLocal .
FILTER(LANG(?publisherNameLocal) = "en")
}

# Wikidata labels via subquery (bulk resolution)
{
SELECT ?publisher ?publisherNameWikidata
WHERE {
{ SELECT DISTINCT ?publisher WHERE { ?dataset dcterms:publisher ?publisher } }
SERVICE <https://query.wikidata.org/sparql> {
?publisher rdfs:label ?publisherNameWikidata .
FILTER(LANG(?publisherNameWikidata) = "en")
}
}
}

# Prioritize local labels, fallback to Wikidata
BIND(COALESCE(?publisherNameLocal, ?publisherNameWikidata) AS ?publisherName)
}
GROUP BY ?dataset ?title ?description
ORDER BY ?title`;


const endpoint = "https://sparql.kgi.services.base4nfdi.de/api/";
(async () => {
const url = `${endpoint}?query=${encodeURIComponent(sparqlQuery)}`;

try {
const response = await fetch(url, {
method: "GET",
headers: {
"Accept": "application/sparql-results+json"
}
});

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const json = await response.json();

let flattenedData = $.map(json.results.bindings, function (item) {
let flattenedItem = {};
$.each(item, function (key, valueObj) {
if (valueObj.value.includes(",")) {
// If the value contains commas, split into an array
flattenedItem[key] = valueObj.value.split(",").map(s => s.trim());
} else {
// Otherwise, store as a single string
flattenedItem[key] = valueObj.value;
}
});
return flattenedItem;
});

let table = new DataTable('#sparqlTable', {
responsive: true,
data: flattenedData,
columns: [
{
"data": "dataset", "title": "KG Name", "width": "35%", render: function (data, type, row, meta) {
if ((type === "display") && data) {
let link = `${data}`;

data = '<a target="_blank" href="' + link + '">' + row.title + '</a>';
}
return data;
}
},

{data: 'description', title: 'Description'},
{data: "publishers", "title": "Publishers", "width": "35%", render: function (data, type, row, meta) {
if ((type === "display") && data) {
if ((Array.isArray(row.publisherNames)) && (Array.isArray(row.publishers)))
{
let publishers = row.publisherNames.map((name, index) => {
let link = row.publishers[index];
return '<a target="_blank" href="' + link + '">' + name + '</a>';
});
data = publishers.join(", ");
return data;
}
}
let link = `${data}`;
data = '<a target="_blank" href="' + link + '">' + row.publisherNames + '</a>';
return data;
}
}

],
columnDefs: [{
"defaultContent": "-",
"targets": "_all"
}]

});
} catch (error) {
console.error("Error fetching SPARQL data:", error);
return null;
}
})();

</script>
<script src="/js/contribute.js"></script>
</head>

<table id="sparqlTable" class="display">
Expand Down
134 changes: 134 additions & 0 deletions static/js/contribute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
const sparqlQuery = `PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?dataset ?title ?description
(GROUP_CONCAT(DISTINCT ?publisher; separator=", ") AS ?publishers)
(GROUP_CONCAT(DISTINCT ?publisherName; separator=", ") AS ?publisherNames)
WHERE {
# Basic dataset metadata
?dataset a dcat:Dataset ;
dcterms:title ?title ;
dcterms:publisher ?publisher .

# Optional description
OPTIONAL { ?dataset dcterms:description ?description }

# Local English labels (if available)
OPTIONAL {
?publisher rdfs:label ?publisherNameLocal .
FILTER(LANG(?publisherNameLocal) = "en")
}

# Wikidata labels via subquery (bulk resolution)
{
SELECT ?publisher ?publisherNameWikidata
WHERE {
{ SELECT DISTINCT ?publisher WHERE { ?dataset dcterms:publisher ?publisher } }
SERVICE <https://query.wikidata.org/sparql> {
?publisher rdfs:label ?publisherNameWikidata .
FILTER(LANG(?publisherNameWikidata) = "en")
}
}
}

# Prioritize local labels, fallback to Wikidata
BIND(COALESCE(?publisherNameLocal, ?publisherNameWikidata) AS ?publisherName)
}
GROUP BY ?dataset ?title ?description
ORDER BY ?title`;


const endpoint = "https://sparql.kgi.services.base4nfdi.de/api/";
(async () => {
const url = `${endpoint}?query=${encodeURIComponent(sparqlQuery)}`;

try {
const response = await fetch(url, {
method: "GET",
headers: {
"Accept": "application/sparql-results+json"
}
});

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const json = await response.json();

let flattenedData = $.map(json.results.bindings, function (item) {
let flattenedItem = {};
$.each(item, function (key, valueObj) {
if (valueObj.value.includes(",")) {
// If the value contains commas, split into an array
flattenedItem[key] = valueObj.value.split(",").map(s => s.trim());
} else {
// Otherwise, store as a single string
flattenedItem[key] = valueObj.value;
}
});
return flattenedItem;
});

let table = new DataTable('#sparqlTable', {
responsive: true,
data: flattenedData,
columns: [
{
"data": "dataset", "title": "KG Name", "width": "35%", render: function (data, type, row, meta) {
if ((type === "display") && data) {
let link = `${data}`;

data = '<a target="_blank" href="' + link + '">' + row.title + '</a>';
}
if (type === "filter" || type === "sort") {
// Include both title and link in the searchable text
return `${row.title} ${data}`;
}
return data;
}
},

{data: 'description', title: 'Description'},
{
data: "publishers", "title": "Publishers", "width": "35%", render: function (data, type, row, meta) {
if ((type === "display") && data) {
if ((Array.isArray(row.publisherNames)) && (Array.isArray(row.publishers))) {
let publishers = row.publisherNames.map((name, index) => {
let link = row.publishers[index];
return '<a target="_blank" href="' + link + '">' + name + '</a>';
});
data = publishers.join(", ");
return data;
}
}
if (type === "filter" || type === "sort") {
// include both names and URLs in the searchable text
if (Array.isArray(row.publisherNames) && Array.isArray(row.publishers)) {
return row.publisherNames.join(" ") + " " + row.publishers.join(" ");
}
// fallback for single string values
return `${row.publisherNames ?? ""} ${data ?? ""}`;
}
let link = `${data}`;
data = '<a target="_blank" href="' + link + '">' + row.publisherNames + '</a>';
return data;
}
}

],
columnDefs: [{
"defaultContent": "-",
"targets": "_all"
}]

});
} catch (error) {
console.error("Error fetching SPARQL data:", error);
return null;
}
})();