Closed PyHahiro closed 4 months ago
Although not documented, this is actually possible. See SparnaturalSpecificationFactory, line 14
It in fact seems like my minified .js is going through the right builder, though I don't have the same result while getting the config as a ttl string or getting the config via an API call that gives me that same ttl
I tested with a simple ontology implemented one class and got the following error message :
Error: No value received on "classTypeValueSelected"
Sparnatural version 8.6.0
Example log from the builder
Attempt to parse determining format from path https://sparnatural.eu../. [sparnatural.js:2:1743001](webpack://_N_E/node_modules/sparnatural/dist/sparnatural.js?4a1c)
Attempt to parse in Turtle... [sparnatural.js:2:1743109](webpack://_N_E/node_modules/sparnatural/dist/sparnatural.js?4a1c)
NodeShapes with at least one property [sparnatural.js:2:1769720](webpack://_N_E/node_modules/sparnatural/dist/sparnatural.js?4a1c)
Found languages in configuration :
Example ontology ttl string working from API but not from Direct insertion :
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sparna: <http://data.sparna.fr/ontologies/sparnatural-config-core#> .
@prefix ds: <http://data.sparna.fr/ontologies/sparnatural-config-datasources#> .
@base <http://example.org/> .
<http://example.org/> rdf:type owl:Ontology .
#################################################################
# Object Properties
#################################################################
:hasBooks rdfs:subPropertyOf sparna:AutocompleteProperty ;
rdfs:domain :Library ;
rdfs:range :Book .
#################################################################
# Classes
#################################################################
### http://example.org/Book
:Book rdf:type owl:Class ;
rdfs:subClassOf sparna:SparnaturalClass .
### http://example.org/Library
:Library rdf:type owl:Class ;
rdfs:subClassOf sparna:SparnaturalClass ;
rdfs:subClassOf [ rdf:type owl:Restriction ;
owl:onProperty :has_books ;
owl:allValuesFrom [ rdf:type owl:Restriction ;
owl:onProperty :contains ;
owl:allValuesFrom :Book
]
] .
`;
This is fixed. Passing the string was OK, but the config was always parsed as SHACL, and not OWL. Note that you should provide the config with a call to setAttribute:
let configString=`
@prefix : <http://example.org/> .
...
`;
sparnatural.setAttribute("src",configString);
The official documentation https://docs.sparnatural.eu/Javascript-integration.html specifies the following :
src
It would be nice to enable this config to directly take a string of an OWL Turtle or RDF/XML file content, such as we don't have to have a
path/to/file
but simply get a configuration from a whole ontology string