sparna-git / Sparnatural

Sparnatural : Typescript visual SPARQL query builder for knowledge graphs, configurable with SHACL
http://sparnatural.eu
GNU Lesser General Public License v3.0
206 stars 34 forks source link

Config : read the prefixes from ones declared in the SHACL file #587

Open tfrancart opened 2 months ago

tfrancart commented 2 months ago

It seems N3Store loses the prefixes once the file is parsed. We could try to obtain them through a regex, but that's a hack. The prefixes would be automatically added in the generated SPARQL query We could read the prefixes declared in SHACL:

<https://exemple.fr/MyOntology> a owl:Ontology;
  rdfs:label "My Ontology"@en;
  sh:declare [
    sh:prefix "owl" ;
    sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI ;
  ] ;
  sh:declare [
    sh:prefix "rdf" ;
    sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
  ] ;
  sh:declare [
    sh:prefix "rdfs" ;
    sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI ;
  ] ;
  sh:declare [
    sh:prefix "sh" ;
    sh:namespace "http://www.w3.org/ns/shacl#"^^xsd:anyURI ;
  ] ;
  sh:declare [
    sh:prefix "skos" ;
    sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ;
  ] ;