Closed LucasRembert closed 9 months ago
This may come from your data: can you make an export of your data ? maybe the datatype was inserted as a language in your data. Can you also confirm the version of Sparnatural you are using ?
I use sparnatural version 8.4.0
This is not precise enough wrt to the language and datatypes of literals. Can you please provide a ttl or RDF/XML file ?
I run into the same issue with the following .ttl
@prefix ma: <http://anabasis-assets.com/ontologies/modelisationLycee/Matiere#> .
@prefix pr: <http://anabasis-assets.com/ontologies/modelisationLycee/Professeur#> .
@prefix ly: <http://anabasis-assets.com/ontologies/modelisationLycee/Lyceen> .
@prefix lycee: <http://anabasis-assets.com/ontologies/lycee#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@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#> .
#################################################################
# Classes
#################################################################
pr:Professeur rdfs:subClassOf sparna:SparnaturalClass ;
sparna:defaultLabelProperty rdfs:label ;
sparna:faIcon "fa fa-person-chalkboard" ;
sparna:tooltip "un professeur"@fr ;
rdfs:label "Professeur"@fr .
ma:Matiere rdfs:subClassOf sparna:SparnaturalClass ;
sparna:defaultLabelProperty rdfs:label ;
sparna:faIcon "fa fa-book" ;
sparna:tooltip "une matiere"@fr ;
rdfs:label "Matiere"@fr .
ly:Lyceen rdfs:subClassOf sparna:SparnaturalClass ;
sparna:defaultLabelProperty rdfs:label ;
sparna:faIcon "fa fa-person" ;
sparna:tooltip "un Lycéen"@fr ;
rdfs:label "Lycéen"@fr .
### http://ontologies.sparna.fr/sparnatural-demo-dbpedia#Text
lycee:Text rdf:type owl:Class ;
rdfs:subClassOf rdfs:Literal ;
sparna:faIcon "fa-solid fa-font" ;
sparna:tooltip "An attribute, a property that describes the object, like a name or a description. <br/><br/>Use this to select the name of the object."@en ,
"Un attribut qui caractérise l'objet, comme un nom ou une description. <br/><br/>Choisissez ceci pour sélectionner le nom de l'objet"@fr ;
rdfs:label "Text"@en ,
"Texte"@fr .
#################################################################
# Object Properties
#################################################################
# specialise: Professeur
pr:specialise rdfs:subPropertyOf sparna:AutocompleteProperty ;
rdfs:domain pr:Professeur ;
rdfs:range ma:Matiere ;
sparna:enableOptional "false"^^xsd:boolean ;
sparna:enableNegation "false"^^xsd:boolean ;
ds:datasource ds:literal_list_alpha ;
rdfs:label "se spécialise dans"@fr ,
"specialize himself in"@en .
# enseigne: Professeur
pr:enseigne rdfs:subPropertyOf sparna:ListProperty ;
rdfs:domain pr:Professeur ;
rdfs:range ly:Lyceen ;
sparna:enableOptional "false"^^xsd:boolean ;
sparna:enableNegation "false"^^xsd:boolean ;
ds:datasource ds:search_rdfslabel_contains ;
rdfs:label "enseigne à l'élève"@fr ,
"teach student"@en .
# nom du prof
pr:nom rdfs:subPropertyOf sparna:AutocompleteProperty ;
rdfs:domain pr:Professeur ;
rdfs:range lycee:Text ;
sparna:enableOptional "true"^^xsd:boolean ;
sparna:enableNegation "true"^^xsd:boolean ;
rdfs:label "a comme nom"@fr ,
"has name"@en .
It seems like having an AutocompleteProperty with rdfs:range a Literal uses the : ds:datasource ds:search_literal_contains ; which does the right search and returns the following data list :
But when I click on a result, for example, Livaitom, I get the following sparql query :
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?Professeur_1 ?Professeur_1_label WHERE {
?Professeur_1 rdf:type <http://anabasis-assets.com/ontologies/modelisationLycee/Professeur#Professeur>.
?Professeur_1 rdfs:label ?Professeur_1_label.
?Professeur_1 <http://anabasis-assets.com/ontologies/modelisationLycee/Professeur#nom> "Livaitom"@xsd:string.
}
As you can see "Livaitom" is transformed into "Livaitom"@xsd:string
I expect literal to be transform the following way : ?literal^^?datatype
and not ?literal@?datatype
In most similar example, you are not using autocompleteProperty but SearchProperty, and it works but it doesn't achieve the same need, for example, if I use SearchProperty and click on a result, for example, Livaitom, I get the following sparql query :
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?Professeur_1 ?Professeur_1_label WHERE {
?Professeur_1 rdf:type <http://anabasis-assets.com/ontologies/modelisationLycee/Professeur#Professeur>.
?Professeur_1 rdfs:label ?Professeur_1_label.
?Professeur_1 <http://anabasis-assets.com/ontologies/modelisationLycee/Professeur#nom> ?Text_2.
FILTER(REGEX(STR(?Text_2), "tom", "i"))
}
Both widgets have different purposes so I expect them to work differently, but I think this highlight where may the issue comes from to help your debugging the issue (if that is one)
I would also add that we should add the xsd prefix in the sparql query if it not already in yet
This is fixed. Let me know if it works for you if you can test on the latest master branch. Otherwise you need to wait for the next release. Thanks
I use the following sparnatural configuration:
When it came to making my choice with sparnatural :
The SPARQL query is formatted as follows:
This way, the query cannot be executed due to the incorrect formatting of the XSD:string uri (@http://www.w3.org/2001/xmlschema#string). Instead, the query should be :