Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
upnd
rcf-sparnatural
Commits
9828f63c2f24
Commit
9a1661c9
authored
Jan 21, 2021
by
Élodie Thiéblin
Browse files
feat: Add Page in Register
parent
deb3e2292f36
Changes
4
Hide whitespace changes
Inline
Side-by-side
rcfexpense_sparnatural.ttl
View file @
9828f63c
...
...
@@ -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
...
...
src/AutocompleteAndListHandlers.js
View file @
9828f63c
...
...
@@ -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
;
}
...
...
src/RDFSpecificationProvider.js
View file @
9828f63c
...
...
@@ -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
,
...
...
src/index.html
View file @
9828f63c
...
...
@@ -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#>
\n
SELECT
"
);
}
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
(
"
}$
"
),
"
}
\n
ORDER 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
,
"
&
"
)
...
...
@@ -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#>
\n
SELECT
"
);
}
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
(
"
}$
"
),
"
}
\n
ORDER 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
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment