Commit 9a1661c9 authored by Élodie Thiéblin's avatar Élodie Thiéblin
Browse files

feat: Add Page in Register

parent deb3e2292f36
......@@ -29,8 +29,11 @@
### http://rcfexpense.logilab.fr/hasPage
:hasPage rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf <http://data.sparna.fr/ontologies/sparnatural-config-core#AutocompleteProperty> ;
owl:inverseOf :isInRegister ;
rdfs:domain :Register ;
rdfs:range :Page .
rdfs:range :Page ;
rdfs:label "a une page"@fr .
### http://rcfexpense.logilab.fr/hasPartsField
......@@ -81,6 +84,15 @@
rdfs:label "est dans la période"@fr .
### http://rcfexpense.logilab.fr/isInRegister
:isInRegister rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf <http://data.sparna.fr/ontologies/sparnatural-config-core#ListProperty> ;
rdfs:domain :Page ;
rdfs:range :Register ;
<http://data.sparna.fr/ontologies/sparnatural-config-core#sparqlString> "^<http://rcfexpense.logilab.fr/hasPage>" ;
rdfs:label "est dans le registre"@fr .
#################################################################
# Data properties
#################################################################
......@@ -164,7 +176,10 @@
### http://rcfexpense.logilab.fr/Page
:Page rdf:type owl:Class .
:Page rdf:type owl:Class ;
rdfs:subClassOf <http://data.sparna.fr/ontologies/sparnatural-config-core#SparnaturalClass> ;
<http://data.sparna.fr/ontologies/sparnatural-config-core#faIcon> "fas fa-file-alt" ;
rdfs:label "Page"@fr .
### http://rcfexpense.logilab.fr/PartsField
......
......@@ -95,8 +95,6 @@ class SparqlTemplateListHandler extends AbstractSparqlAutocompleteAndListHandler
sparql = sparql.replace(reLabelPath, this.labelPath );
}
console.log(sparql);
return sparql;
}
}
......@@ -146,8 +144,6 @@ class SparqlTemplateAutocompleteHandler extends AbstractSparqlAutocompleteAndLis
sparql = sparql.replace(reLabelPath, this.labelPath );
}
console.log(sparql);
return sparql;
}
......
......@@ -35,7 +35,6 @@ var Config = require('./SparnaturalConfig.js');
export class RDFSpecificationProvider {
constructor(n3store, lang) {
console.log("RDFSpecificationProvider");
// init memory store
this.store = n3store;
......@@ -48,7 +47,7 @@ export class RDFSpecificationProvider {
var store = new N3.Store();
// parse input specs
console.log(specs);
// console.log(specs);
const textStream = require('streamify-string')(specs);
const quadStream = rdfParser.parse(
textStream,
......
......@@ -209,11 +209,47 @@
var sparnatural;
$(document).ready(function ($) {
prefixesPostProcess = function (queryString, queryJson) {
if (queryString.indexOf("rdf-schema#") == -1) {
queryString = queryString.replace(
"SELECT ",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \nSELECT "
);
}
return queryString;
};
rdfsLabelPostProcess = function (queryString, queryJson) {
queryString = queryString.replace(
new RegExp("}$"),
" ?this rdfs:label ?label FILTER(lang(?label) = 'fr') \n}"
);
return queryString;
};
orderByPostProcess = function (queryString, queryJson) {
queryString = queryString.replace(
new RegExp("}$"),
"}\nORDER BY ?label LIMIT 5000"
);
queryString = queryString.replace(
"SELECT DISTINCT ?this",
"SELECT DISTINCT (STR(?label) AS ?nom) ?this"
);
return queryString;
};
semanticPostProcess = function (queryString, queryJson) {
queryString = sparnatural.expandSparql(queryString);
queryString = prefixesPostProcess(queryString, queryJson);
return queryString;
};
var defaultSparqlHandler = new SimpleSparqlAutocompleteAndListHandler(
$('#endpoint').text(),
{
semanticPostProcess : function(sparql) {
return sparql;
return semanticPostProcess(sparql);
}
},
null,
......@@ -226,6 +262,7 @@
defaultSparqlHandler,
{
"http://rcfexpense.logilab.fr/Period" : defaultSparqlHandler,
"http://rcfexpense.logilab.fr/Register" : defaultSparqlHandler
}
);
sparnatural = $("#ui-search").Sparnatural({
......@@ -239,12 +276,12 @@
list: rangeBasedHandler,
defaultEndpoint: "http://localhost:3030/rcf/sparql",
sparqlPrefixes: {
RCF: "http://rcfexpense.logilab.fr/",
},
onQueryUpdated: function (queryString, queryJson) {
queryString = semanticPostProcess(queryString, queryJson);
queryString = rdfsLabelPostProcess(queryString, queryJson);
queryString = orderByPostProcess(queryString, queryJson);
$("#sparql code").html(
queryString
.replace(/&/g, "&amp;")
......@@ -257,49 +294,7 @@
});
});
prefixesPostProcess = function (queryString, queryJson) {
if (queryString.indexOf("rdf-schema#") == -1) {
queryString = queryString.replace(
"SELECT ",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \nSELECT "
);
}
return queryString;
};
isPrimaryTopicOfPostProcess = function (queryString, queryJson) {
queryString = queryString.replace(
new RegExp("}$"),
" ?this <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?wikipedia \n}"
);
return queryString;
};
rdfsLabelPostProcess = function (queryString, queryJson) {
queryString = queryString.replace(
new RegExp("}$"),
" ?this rdfs:label ?label FILTER(lang(?label) = 'fr') \n}"
);
return queryString;
};
orderByPostProcess = function (queryString, queryJson) {
queryString = queryString.replace(
new RegExp("}$"),
"}\nORDER BY ?label LIMIT 5000"
);
queryString = queryString.replace(
"SELECT DISTINCT ?this",
"SELECT DISTINCT (STR(?label) AS ?nom) ?this"
);
return queryString;
};
semanticPostProcess = function (queryString, queryJson) {
queryString = prefixesPostProcess(queryString, queryJson);
queryString = sparnatural.expandSparql(queryString);
return queryString;
};
var yasqe = YASQE.fromTextArea(document.getElementById("yasqe"), {
sparql: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment