Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Use-case : define node labels #31

Open
WilliamChelman opened this issue Oct 9, 2023 · 1 comment
Open

Use-case : define node labels #31

WilliamChelman opened this issue Oct 9, 2023 · 1 comment

Comments

@WilliamChelman
Copy link

In either context of searching for a node, displaying it in a tree, an autocomplete, or wherever other case. We should be able to define the logic in which the label of a given node is determined or computed.

Simple property at the sh:PropertyShape level

At its simplest, a property shape could be defined as being used for defining the label of the node. Not advising a particular nomenclature just yet, but it could be defined as such:

<prefLabel>
  a sh:PropertyShape ;
  sh:path skos:prefLabel ;
  sh:datatype rdf:langString ; 
  shui:purpose shui:DefaultLabelPurpose ;
.

A boolean might be enough, but I do like the idea of defining purposes/use-cases for shapes in general (not only linked to labelling, I might created a dedicated issue for that). We could imagine other labelling purposes like shui:AutocompleteLabelPurpose, shui:SearchLabelPurpose, shui:TreeLabelPurpose and so on, depending on what we feel might make sense.

"Templating" at the sh:NodeShape level

The previous proposition would likely work for most cases, but what about label composition? For example, we might want to concatenate, for a given skos:Concept, its skos:prefLabel and the skos:prefLabel of all its "broader chain". For such more complex cases, being able to make use of a sparql query to build the label triples would be a good option:

<Concept>
  a sh:NodeShape ;
  sh:targetClass skos:Concept ;
  shui:labelQuery """a spaqrl query that returns labels"""
.

Wrapping things all together

Defining labelling logic at 2 possible different levels might be both counter-intuitive and hard to follow, so maybe have everything at the sh:NodeShape level instead?

<Concept>
  a sh:NodeShape ;
  sh:targetClass skos:Concept ;
  shui:labelDefinition [ 
    shui:purpose shui:DefaultLabelPurpose ;
    shui:propertyForLabel skos:prefLabel ;
  ]
  shui:labelDefinition [ 
    shui:purpose shui:SearchLabelPurpose ;
    shui:queryForLabel """my awesome SPARQL query""" ;
  ]
.

But I'll stop there for now, as we first need to decide it this feature makes sense in shacl-ui or not 😅

@HolgerKnublauch
Copy link
Contributor

In my experience, the expectation for labels is that they also work in the other direction, e.g. for auto-complete purposes. Do you have thoughts on how this could work if labels are dynamically created?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants