Skip to content

Commit

Permalink
Merge pull request #54 from RDFLib/edmond/list-table-fallback
Browse files Browse the repository at this point in the history
List table view values display local name as fallback when labels are not available. Add missing reg prefix in useRdfStore.
  • Loading branch information
edmondchuc authored May 11, 2023
2 parents bbfe750 + 14610b9 commit afbd57b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/composables/rdfStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const defaultPrefixes: {[token: string]: string} = {
"prov": "http://www.w3.org/ns/prov#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"reg": "http://purl.org/linked-data/registry#",
"sdo": "https://schema.org/",
"sh": "http://www.w3.org/ns/shacl#",
"skos": "http://www.w3.org/2004/02/skos/core#",
Expand Down
12 changes: 12 additions & 0 deletions src/views/ItemListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ function getSearchDefaults(): {[key: string]: string} { // need IRI of parent to
}
}
function getIRILocalName(iri: string) {
let result = iri.split("#");
if (result.length === 1) {
return result[0].split("/").slice(-1)[0]
}
else {
return result.slice(-1)[0];
}
}
onMounted(() => {
let paginationParams = "";
Expand Down Expand Up @@ -161,11 +171,13 @@ onMounted(() => {
} else if (q.predicate.value === qname("prez:link")) {
c.link = q.object.value;
} else if (q.predicate.value === qname("reg:status")) {
c.status = getIRILocalName(q.object.value);
store.value.forObjects(result => {
c.status = result.value;
}, q.object, qname("rdfs:label"), null);
} else if (q.predicate.value === qname("prov:qualifiedDerivation")) {
store.value.forObjects(result => {
c.derivationMode = getIRILocalName(result.value);
store.value.forObjects(innerResult => {
c.derivationMode = innerResult.value;
}, result,qname("rdfs:label"), null);
Expand Down

0 comments on commit afbd57b

Please sign in to comment.