Re: Misusing shacl for sparql examples?

Jerven,

You may think about creating a new namespace such as

PREFIX shx: <http://example.com/ns/shx#>

for those things that aren't currently defined in the SHACL specification
(or have a different meaning than what a SHACL processor by itself may
utilize. For instance, you may define two shacl-esque properties called
shx:jsGetter, shx:jsSetter as part of a SHACL declaration:

Shape:Age a sh:PropertyShape;
      sh:name "age"^^xsd:string ;
      sh:nodeKind sh:Literal ;
      sh:datatype xsd:integer ;
      sh:path Person:birthDate ;
      shx:jsGetter """()=>{ return parseInt(Date.now() -
Date($this.getValue())}"""^^processLanguage:Javascript ;
      shx:jsSetter """
($age)=>"""{ (age)=>{
    const currentYear = new Date().getFullYear();
    const birthYear = currentYear - age;
    const birthDate = new Date(birthYear, 0, 1); // Assuming birthdate is
January 1st of the birth year
    $this.setValue(birthDate.toDateString())
    return birthDate.toDateString();
    }}"""^^processLanguage:Javascript ;
    .

You would be responsible for implementing and invoking the functionality of
shx:jsGetter and shx:jsSetter, of course.


*Kurt Cagle*
Editor in Chief
The Cagle Report
kurt.cagle@gmail.com
443-837-8725 <http://voice.google.com/calls?a=nc,%2B14438378725>


On Sun, Feb 18, 2024 at 1:25 AM Holger Knublauch <holger@topquadrant.com>
wrote:

>
>
> On 16 Feb 2024, at 10:21 pm, Jerven Tjalling Bolleman
> <Jerven.Bolleman@sib.swiss> wrote:
>
> Hi All,
>
> I have a question, we at SIB kinda misuse shacl to represent our query
> examples.
> This started with the UniProt sparql  endpoint and spread to others and we
> are considering this as an internal standard for all our query examples.
>
> e.g.
> https://sparql.uniprot.org/sparql/?query=DESCRIBE+%3Chttps%3A%2F%2Fsparql.uniprot.org%2F.well-known%2Fsparql-examples%2F16%3E&format=html&query=DESCRIBE+%3Chttps%3A%2F%2Fsparql.uniprot.org%2F.well-known%2Fsparql-examples%2F16%3E
>
> We use the sh:SPARQLExecutable, sh:SPARQLSelectExecutable, sh:prefix,
> sh:namespace, sh:select, sh:ask, sh:SPARQLAskExecutable etc.
> Unfortunately we also  invented our own sh:describe as in the example
> linked.
>
> I was wondering if this use of the ShACL vocabulary is acceptable or
> should be discouraged. As well as general ideas on making this more usable
> in ShACL native tools.
>
>
> I think for symmetry reasons alone, the SHACL namespace should define all
> relevant variations.
>
> Please feel free to record an Issue at https://github.com/w3c/shacl/issues so
> that the CG and future 1.2 WG can address that.
>
> Meanwhile I believe what you are doing makes practical sense, for this
> particular case. Needless to say this should NOT encourage everyone else to
> use undefined terms from the sh: namespace.
>
> Holger
>
>
>
> Regards,
> Jerven
>
>
> [image: SIB logo]
> *Jerven Tjalling Bolleman*
> Principal Software Developer
> *SIB** | Swiss Institute of Bioinformatics*
> 1, rue Michel Servet - CH 1211 Geneva 4 - Switzerland
> t +41 22 379 58 85
> Jerven.Bolleman@sib.swiss - www.sib.swiss
>
>
>

Received on Sunday, 18 February 2024 12:03:33 UTC