Skip to content

Commit

Permalink
Merge pull request #130 from RDFLib/jamie/list-bugfix
Browse files Browse the repository at this point in the history
Fix for list pages not reading rdfs:member & /object page links not rendering properly
  • Loading branch information
jamiefeiss authored Jan 25, 2024
2 parents 2b6febe + a1d7253 commit ef1bfea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/views/ItemListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useRdfStore } from "@/composables/rdfStore";
import { useApiRequest } from "@/composables/api";
import { apiBaseUrlConfigKey, perPageConfigKey, type Breadcrumb, type PrezFlavour, type Profile, type ListItemExtra, type ListItemSortable } from "@/types";
import { getPrezSystemLabel } from "@/util/prezSystemLabelMapping";
import { sortByTitle, getBaseClassFromLink, ensureAnnotationPredicates, getLabel, getDescription } from "@/util/helpers";
import { sortByTitle, getBaseClassFromLink, ensureAnnotationPredicates, getLabel, getDescription, getObjects } from "@/util/helpers";
import { ALT_PROFILE_CURIE } from "@/util/consts";
import ItemList from "@/components/ItemList.vue";
import ProfilesTable from "@/components/ProfilesTable.vue";
Expand Down Expand Up @@ -230,8 +230,7 @@ function getProperties() {
// for /c/profiles, etc. need to look for prez:CatPrezProfile, etc.
} else {
// nodeList = store.value.getObjects(countQuad.subject, namedNode(qnameToIri("rdfs:member")), null);
nodeList = store.value.getObjects(countQuad.subject, namedNode(qnameToIri("dcterms:hasPart")), null); // TODO: need to cater for rdfs:member & dcterms:hasPart
nodeList = getObjects(countQuad.subject.value, [qnameToIri("rdfs:member"), qnameToIri("dcterms:hasPart")], store.value);
const containerBaseClass = iriToQname(getBaseClassFromLink(route.path.slice(0, route.path.lastIndexOf("/"))).iri);
searchConfig.value = {
containerUri: countQuad.subject.value,
Expand Down
4 changes: 3 additions & 1 deletion src/views/ObjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ onMounted(async () => {
item.value.title = getLabel(subject.value, store.value);
item.value.description = getDescription(subject.value, store.value);
const id = store.value.getObjects(subject, namedNode(qnameToIri("dcterms:identifier")), null)[0].value;
store.value.forEach(q => {
if (q.predicate.value === qnameToIri("a")) {
item.value.types.push({
iri: q.object.value,
title: getLabel(q.object.value, store.value),
});
} else if (q.predicate.value === qnameToIri("prez:link")) {
const parentIds = store.value.getQuads(null, namedNode(qnameToIri("dcterms:identifier")), null, null).filter(q1 => q.object.value.includes(q1.object.value));
const parentIds = store.value.getQuads(null, namedNode(qnameToIri("dcterms:identifier")), null, null).filter(q1 => q1.object.value !== id && q.object.value.includes(q1.object.value));
if (parentIds.length === 1) {
let parentIri = parentIds[0].subject.value;
Expand Down

0 comments on commit ef1bfea

Please sign in to comment.