Skip to content

Commit

Permalink
Add a boolean variable is_class
Browse files Browse the repository at this point in the history
This allows to check if a selected resource_iri is a class or an
instance.
TODO: Should we add a flag for graph_iri, too?
  • Loading branch information
splattater committed Aug 19, 2024
1 parent e248f89 commit fe81a96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/InstanceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import QueryResultList from './QueryResultList.vue'
</script>

<template>
<QueryResultList title="Instance List" search :query="'select distinct ?instance { ?instance a <' + resource_iri + '> } order by ?instance'" select-variable="instance" itemClass="py-2" ref="instanceList" :activeResource="resource_iri" :selectResource="(iri) => {useSelectionStore().changeResourceIri(iri)}" />
<QueryResultList title="Instance List" search :query="'select distinct ?instance { ?instance a <' + resource_iri + '> } order by ?instance'" select-variable="instance" itemClass="py-2" ref="instanceList" :activeResource="resource_iri" :selectResource="(iri) => {useSelectionStore().changeResourceIri(iri, false)}" />
</template>

<script>
Expand Down
8 changes: 7 additions & 1 deletion src/stores/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ export const useSelectionStore = defineStore('selection', {
state: () => ({
graph_iri: config.graph_iri,
resource_iri: config.resource_iri,
is_class: true,
}),
actions: {
changeGraphIri (graphIri) {
console.log('Change graph Iri to ' + graphIri)
this.graph_iri = graphIri
},
changeResourceIri (resourceIri) {
changeResourceIri (resourceIri, isClass=true) {
console.log('Change resource Iri to ' + resourceIri)
this.resource_iri = resourceIri
if (isClass == true) {
this.is_class = true
} else {
this.is_class = false
}
}
},
})

0 comments on commit fe81a96

Please sign in to comment.