Skip to content

Support for RDF 1.1 Skolem IRIs #210

@wouterbeek

Description

@wouterbeek

A feature of RDF 1.1 is the optional use of Skolem IRIs, i.e. well-known IRIs that systematically replace blank nodes. SPARQL 1.1 does not include features that support such Skolem IRIs. E.g. queries that use 'isBlank/1' and/or 'isIRI/1' no longer work after Skolemization is applied.

Why?

Skolem IRIs were introduced in RDF 1.1, so after SPARQL 1.1 was finalized. This means that the SPARQL standard was not yet able to provide support for the Skolem IRI feature.

Previous work

I use the following SPARQL Functions myself (note: I am not a programmer and these functions have not been tested):

sparql:isBlankOrSkolemIri
  a sh:SPARQLFunction;
  rdfs:isDefinedBy <https://triplydb.com/Triply/sparql>;
  sh:description "Similar to the isBlank function in the SPARQL standard, but returns true for blank node-replacing well-known IRIs as well."@en;
  sh:parameter param:isBlankOrSkolemIri_term;
  sh:prefixes <https://triplydb.com/Triply/sparql>;
  sh:returnType xsd:boolean;
  sh:select '''
    select $return {
      bind(isBlank($term) || sparql:isSkolemIRI($term) as $return)
    }'''.
param:isBlankOrSkolemIri_term
  a sh:Parameter;
  sh:class rdfs:Resource;
  sh:order 1;
  sh:path param:term.

sparql:isNonSkolemIRI
  a sh:SPARQLFunction;
  rdfs:isDefinedBy <https://triplydb.com/Triply/sparql>;
  sh:description "Similar to the isIRI function in the SPARQL standard, but returns false for blank node-replacing well-known IRIs."@en;
  sh:parameter param:isNonSkolemIRI_term;
  sh:prefixes <https://triplydb.com/Triply/sparql>;
  sh:returnType xsd:boolean;
  sh:select '''
    select $return {
      bind(isIRI($term) && !sparql:isSkolemIRI($term) as $return)
    }'''.
param:isNonSkolemIRI_term
  a sh:Parameter;
  sh:class rdfs:Resource;
  sh:order 1;
  sh:path param:term.

sparql:isSkolemIRI
  a sh:SPARQLFunction;
  rdfs:isDefinedBy <https://triplydb.com/Triply/sparql>;
  sh:parameter param:isSkolemIRI_term;
  sh:prefixes <https://triplydb.com/Triply/sparql>;
  sh:returnType xsd:boolean;
  sh:select '''
    select $return {
      bind(isIRI($term) && strstarts(sparql:iri_path($term), '/.well-known/genid/') as $return)
    }'''.
param:isSkolemIRI_term
  a sh:Parameter;
  sh:class rdfs:Resource;
  sh:nodeKind sh:IRI;
  sh:order 1;
  sh:path param:term.

Proposed solution

Add functions like 'isBlankOrSkolemIri/1', 'isNonSkolemIRI/1', and isSkolemIRI/1' to the language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions