SPARQL-Generate - query and generate both RDF and text
Generate RDF or text from web documents in XML, JSON, CSV, GeoJSON, HTML, CBOR, plain text with regular expressions.
Generate RDF or text streams from large CSV documents, MQTT or WebSocket streams, repeated HTTP Get operations.
Directly generate HDT as the output of big transformations.
Use it as partial STTL and SPARQL Function implementations.
Extend it to support new data sources and formats.
SPARQL-Generate is an extension of SPARQL 1.1 for querying not only RDF datasets but also documents in arbitrary formats.
It offers a simple and expressive template-based option to generate RDF Graphs or text, from documents and different streams. It presents the following advantages:
Anyone familiar with SPARQL can easily learn SPARQL-Generate;
Learning SPARQL-Generate helps you learning SPARQL;
SPARQL-Generate leverages the expressivity of SPARQL 1.1: Aggregates, Solution Sequences and Modifiers, SPARQL functions and their extension mechanism.
It integrates seamlessly with existing standards for consuming Semantic Web data, such as SPARQL or Semantic Web programming frameworks.
Présentation Webinaire Cohésion - Concevoir et mettre en place une CMDB, comm...
SPARQL-Generate, présentation SemWeb.Pro 2019
1. SPARQL-Generate: Génération de
RDF et de texte à partir de RDF et
flux de documents dans des formats
hétérogènes
Maxime Lefrançois
Maxime.Lefrancois@emse.fr
http://maxime-lefrancois.info/
MINES Saint-Étienne – Institut Henri Fayol
Laboratoire Hubert Curien UMR CNRS 5516
2. 2
M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL extension for generating RDF from heterogeneous formats,
In Proc. Extended Semantic Web Conference, 2017
+ EKAW, Hackatons, ESWC Tutorial 2018, PFIA Tutorial 2019, OEG Tutorial
Génération de RDF à partir de nombreux formats
3. Exigences
3
M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL extension for generating RDF from heterogeneous formats,
In Proc. Extended Semantic Web Conference, 2017
+ EKAW, Hackatons, ESWC Tutorial 2018, PFIA Tutorial 2019, OEG Tutorial
- Transformer plusieurs sources …
- ... avec des formats hétérogènes
- Être extensible à d’autres formats de données
- Être facile à utiliser par les experts du web sémantique
- S’intégrer dans un workflow web sémantique classique
- Être flexible et facile à maintenir
- Contextualiser la transformation avec un jeu de données RDF
- Modulariser / découpler / composer des transformations
- Permettre la transformation des données, agrégats, filtres, ...
- Générer des listes RDF
- Performances
- Transformer les formats binaires comme les formats textuels
- Transformer les gros documents (sortie en HDT)
- Générer des flux de RDF à partir de flux de documents
4. Question de recherche
Comment concevoir un langage de
transformation…
…suffisamment expressif pour couvrir nos cas d’utilisation?
…simple à utiliser?
…facile à étendre à d’autres formats?
4
6. Processus de génération de RDF
6
Patron de sélection
Xpath, JSONpath, CSS selectors, regex, etc.
7. Processus de génération de RDF
7
Patron de sélection
Xpath, JSONpath, CSS selectors, regex, etc.
8. Processus de génération de RDF
8
?
?
?
Définition de
patron de graphe
ex:salary
ex:Director
Patron de sélection
Xpath, JSONpath, CSS selectors, regex, etc.
9. Processus de génération de RDF
9
?
?
?
Patron de sélection
Xpath, JSONpath, CSS selectors, regex, etc.
ex:salary
ex:Director
Définition de
patron de graphe
+ choix de l’ontologie
15. Étend SPARQL, donc on a gratuitement...
15
?
?
?
Patron de sélection
Xpath, JSONpath, CSS selectors, regex, etc.
Graph pattern
definition
ex:salary
ex:Director
+ Select
ontologies
• Implémentable sur les moteurs SPARQL
• Facile à apprendre quand on connait SPARQL
• On apprend SPARQL quand on utilise SPARQL-Generate
• La définition de patron de graph n’est pas orientée sujet
• SPARQL 1.1 FILTER BIND OPTIONAL,...
• Fonctions et opérateurs standard dans SPARQL 1.1
STR LANG LANGMATCHES DATATYPE BOUND IRI URI BNODE RAND ABS CEIL
FLOOR ROUND CONCAT SUBSTR STRLEN REPLACE UCASE LCASE
ENCODE_FOR_URI CONTAINS STRSTARTS STRENDS STRBEFORE STRAFTER YEAR
MONTH DAY HOURS MINUTES SECONDS TIMEZONE TZ NOW UUID STRUUID MD5
SHA1 SHA256 SHA384 SHA512 COALESCE IF STRLANG STRDT sameTerm isIRI
isURI isBLANK isLITERAL isNUMERIC REGEX + * / = > < || &&
• Mécanime standard d’extension des fonctions dans SPARQL 1.1
• SPARQL 1.1 ORDER LIMIT OFFSET
• SPARQL 1.1 GROUP BY, HAVING, Fonctions d’agrégation
COUNT SUM MIN MAX AVG SAMPLE GROUP_CONCAT
16. 16
M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL extension for generating RDF from heterogeneous formats,
In Proc. Extended Semantic Web Conference, 2017
+ EKAW, Hackatons, ESWC Tutorial 2018, PFIA Tutorial 2019, OEG Tutorial
Pas seulement « théoriquement cool »
https://w3id.org/sparql-generate/
Implémentation open-source Licence Apache 2.0 basée sur Apache Jena
développement financé par ITEA, ANR, ENGIE, ETSI
Expressif, Performant, Extensible à d’autres formats
API (sur Maven Central)
JAR
Web playground + tutoriel
17. 17
M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL extension for generating RDF from heterogeneous formats,
In Proc. Extended Semantic Web Conference, 2017
+ EKAW, Hackatons, ESWC Tutorial 2018, PFIA Tutorial 2019, OEG Tutorial
SPARQL-Generate is not just « theoretically cool »
https://w3id.org/sparql-generate/
Implémentation open-source Licence Apache 2.0 basée sur Apache Jena
développement financé par ITEA, ANR, ENGIE, ETSI
Expressif, Performant, Extensible à d’autres formats
API (sur Maven Central)
JAR
Web playground + tutoriel
Package pour Sublime Text
18. 18
?
?
?
Selection patterns
Xpath, JSONpath, CSS selectors, regex, etc.
Graph pattern
definition
ex:salary
ex:Director
+ Select
ontologies
iter&fun functions ont des URIs dereferenceables
19. iter&fun functions ont des URIs dereferenceables
19
?
?
?
Selection patterns
Xpath, JSONpath, CSS selectors, regex, etc.
Graph pattern
definition
ex:salary
ex:Director
+ Select
ontologies
20. Où en est-on de nos exigences?
20
M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL extension for generating RDF from heterogeneous formats,
In Proc. Extended Semantic Web Conference, 2017
+ EKAW, Hackatons, ESWC Tutorial 2018, PFIA Tutorial 2019, OEG Tutorial
- Transformer plusieurs sources …
- ... avec des formats hétérogènes
- Être extensible à d’autres formats de données
- Être facile à utiliser par les experts du web sémantique
- S’intégrer dans un workflow web sémantique classique
- Être flexible et facile à maintenir
- Contextualiser la transformation avec un jeu de données RDF
- Modulariser / découpler / composer des transformations
- Permettre la transformation des données, agrégats, filtres, ...
- Générer des listes RDF
- Performances
- Transformer les formats binaires comme les formats textuels
- Transformer les gros documents (sortie en HDT)
- Générer des flux de RDF à partir de flux de documents
- Pas orienté sujet?
- Inclue des parties de différentes sources dans un littéral?
21. Il y a d’avantage que
SOURCE et ITERATOR ...
21
Ce que je n’ai pas encore dit
30. One peut générer du HDT directement
30
20 seconds for a 20 MB gene2go sample, output is 17 MB of HDT
9 min, 20 sec for a 145 MB gene2go sample, output is "only" 114 MB HDT
31. Il y a d’avantage que
GENERATE ...
31
Ce que je n’ai pas encore dit
32. 32
FUNCTION
Sous-ensemble de LDScript: a Linked Data Script Language
http://ns.inria.fr/sparql-extension/
Olivier Corby, Catherine Faron-Zucker and Fabien Gandon, LDScript: a Linked Data Script Language, ISWC 2017, spotlight paper
33. 33
TEMPLATE
Génère du texte à partir de RDF
Sous-ensemble étendu de STTL: the SPARQL Template Transformation Language
https://ns.inria.fr/sparql-template/
Olivier Corby and Catherine Faron-Zucker. A Transformation Language for RDF based on SPARQL. Web Information Systems
and Technologies - Selected Extended Papers from WEBIST 2015. Springer-Verlag, 2015. Best paper nominee.
• Eléments FORMAT GROUP BOX
• Fonctions binding st:call-template(templateURI, param1, param2, ...)
34. 34
TEMPLATE
Génère du texte à partir de RDF
Sous-ensemble étendu de STTL: the SPARQL Template Transformation Language
https://ns.inria.fr/sparql-template/
Olivier Corby and Catherine Faron-Zucker. A Transformation Language for RDF based on SPARQL. Web Information Systems
and Technologies - Selected Extended Papers from WEBIST 2015. Springer-Verlag, 2015. Best paper nominee.
• Eléments FORMAT GROUP BOX combiné avec ITERATOR SOURCE
• Fonctions binding st:call-template(templateURI, param1, param2, ...)
36. 36
SELECT
SPARQL Select:
- augmenté des clauses ITERATOR SOURCE
- avec sucre syntaxique, etc.
• Les requêtes SELECT génèrent une liste de solution binding…
• … Comme les clauses ITERATOR !
37. Use ITERATORS in sequence?
Let’s give you an idea of how an unoptimized query looks like
39. Exemple d’optimisation de requête
FROM GENERATE {}
et FROM GENERATE <>(param1, param2, …)
Requête optimisée en générant et requêtant un graphe RDF intermédiaire
41. SPARQL-Generate
fait plus que de la simple génération de RDF
41
En conclusion
Deux exemples
• Génération de documentation pour une ontologie (remplacement de LODE)
• Génération d’ontologie à partir de configuration (RDF et fichiers)
42. 42
En conclusion
SPARQL-Generate
n’est pas qu’une simple preuve de concept
Utilisable
• En ligne, comme JAR, dans Sublime Text, en API
• Extensible à vos propres fonctions et itérateurs
• Aide, contribution, issues, suggestions d’amélioration
https://github.com/sparql-generate/sparql-generate/issues