<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sparna Blog &#187; Thomas Francart</title>
	<atom:link href="https://blog.sparna.fr/author/thomas/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sparna.fr</link>
	<description>Web de données &#124; Architecture de l&#039;information &#124; Accès aux connaissances</description>
	<lastBuildDate>Tue, 03 Jun 2025 10:30:27 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Sparnatural as a simple data federation facade</title>
		<link>https://blog.sparna.fr/2025/06/03/sparnatural-data-federation-sparql/</link>
		<comments>https://blog.sparna.fr/2025/06/03/sparnatural-data-federation-sparql/#comments</comments>
		<pubDate>Tue, 03 Jun 2025 10:30:27 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[Sparnatural]]></category>
		<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">https://blog.sparna.fr/?p=1995</guid>
		<description><![CDATA[<p>Together with the FAIR-data-evangelists of the MSH Val-de-Loire, we rencently worked on the v2 of the OpenArchaeo portal that uses Sparnatural as its core visual data exploration component (the v2 is not yet visible, but hopefully will be finalized and announced soon !) It uses a new feature of Sparnatural : the ability to act&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2025/06/03/sparnatural-data-federation-sparql/">Sparnatural as a simple data federation facade</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Together with the FAIR-data-evangelists of the MSH Val-de-Loire, we rencently worked on the v2 of the OpenArchaeo portal that uses <a href="https://sparnatural.eu/">Sparnatural</a> as its core visual data exploration component (the v2 is not yet visible, but hopefully will be finalized and announced soon !)</p>
<p>It uses a new feature of Sparnatural : the ability to act as a <strong>single UI facade to multiple SPARQL endpoints</strong>. The user visually writes a single query, the query is sent to multiple data sources, and results are aggregated to be presented to the user in a single result set, that includes each result provenance.</p>
<p>This is depicted in the diagram below:</p>
<p>&nbsp;</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-02-07-52-39.png"><img class="aligncenter wp-image-2004 size-full" src="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-02-07-52-39.png" alt="" width="851" height="720" /></a></p>
<p>The user writes his query visually in Sparnatural, here <em>&laquo;&nbsp;All archaelogical sites where burials have been found, with the name of their discoverer, if known&nbsp;&raquo; :</em></p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-01-21-04-25.png"><img class="aligncenter size-full wp-image-1997" src="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-01-21-04-25.png" alt="Capture d’écran du 2025-06-01 21-04-25" width="1225" height="340" /></a></p>
<p>The visual query is translated into SPARQL, and that <strong>SPARQL query is sent to each data source</strong> in the federation (actually, the user can select the ones he wants to query). This is depicted by the green arrows in the diagram, numbered &laquo;&nbsp;1&nbsp;&raquo;.</p>
<p>The SPARQL query looks like the following; note how it uses complex CIDOC-CRM property paths, such as the highlighted one, while the visual user query was simple:</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-02-07-58-49.png"><img class="aligncenter size-full wp-image-2007" src="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-02-07-58-49.png" alt="Capture d’écran du 2025-06-02 07-58-49" width="1228" height="326" /></a></p>
<p><strong>Each SPARQL service returns a result</strong>. This is depicted by the orange arrows in the diagram, numbered &laquo;&nbsp;2&nbsp;&raquo;.</p>
<p>When every endpoint have answered, their <strong>results are aggregated into a single result set</strong>. This is number &laquo;&nbsp;3&nbsp;&raquo; in the diagram. During this aggregation, an extra column is added in the result set, containing the name of the source from which the result was retrieved.</p>
<p>The user sees the aggregated result; here, the name of the site, the name of its discovered when known, and the source in which the result was found:</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-01-21-05-24.png"><img class="aligncenter size-full wp-image-1998" src="https://blog.sparna.fr/wp-content/uploads/2025/06/Capture-d’écran-du-2025-06-01-21-05-24.png" alt="Capture d’écran du 2025-06-01 21-05-24" width="1274" height="1025" /></a></p>
<p>This is possible thanks to the <a href="https://docs.sparnatural.eu/Querying-multiple-endpoints.html"><strong>catalog configuration of Sparnatural</strong></a><strong>.</strong></p>
<p>Sparnatural can be passed a catalog of SPARQL endpoints in a federation, and in this case, it will send the same SPARQL query to each, and will aggregate the results. This happens for the final query of course, but also <a href="https://docs.sparnatural.eu/Querying-multiple-endpoints.html#sparnatural-behavior">during selection of values in the query UI</a>.</p>
<p>There are two main limits of this approach:</p>
<ul>
<li>Limit 1 : <strong>all sources in the federation must share the same data model</strong>, as the same query is sent to every source</li>
<li>Limit 2 : each source must be independant : there should be <strong>no links from one source to another source</strong> so that the query can be solved by each endpoint independantly (so actually, no truly distributed linked data)</li>
</ul>
<p>Those are the reasons I have entitled the post &laquo;&nbsp;<em>simple</em> federation facade&nbsp;&raquo;. Those 2 hypothesis are met in OpenArchaeo, and they were also met in the case of the (never released) prototype of the <a href="https://pro.europeana.eu/project/linked-data-task-force">Europeana Linked Data taskforce</a>. If you know other cases of data federation in which this is also true, tell us ! (we could actually try the same on a few DBPedia endpoints using the <a href="https://dbpedia.org/ontology/">dbo ontology</a> as a pivot model)</p>
<p>Now guess what ? in Sparnatural we have a &laquo;&nbsp;query UI to SPARQL&nbsp;&raquo; transformation step, thanks to the <a href="https://docs.sparnatural.eu/how-to-configure-shacl/How-to-configure-Sparnatural-shacl.html">SHACL configuration of Sparnatural</a>. Basically we can map a UI property on an underlying property path. Then it would not be too difficult to do this mapping on a source-by-source basis, to have different queries sent to each source, from a single query in the UI. The result set structure would be the same, and result set aggregation can still happen. We would then overcome the first limit described above. <strong>That&rsquo;s the next step !</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2025/06/03/sparnatural-data-federation-sparql/">Sparnatural as a simple data federation facade</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2025/06/03/sparnatural-data-federation-sparql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sparnatural SHACL configuration : manual, automated, off-the-shelf</title>
		<link>https://blog.sparna.fr/2025/01/21/sparnatural-shacl-configuration-manual-automated-off-the-shelf/</link>
		<comments>https://blog.sparna.fr/2025/01/21/sparnatural-shacl-configuration-manual-automated-off-the-shelf/#comments</comments>
		<pubDate>Tue, 21 Jan 2025 07:00:35 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[SHACL]]></category>
		<category><![CDATA[Sparnatural]]></category>
		<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">https://blog.sparna.fr/?p=1844</guid>
		<description><![CDATA[<p>Sparnatural is a knowledge graph visual browser made for end-users. The user is guided in the creation of her graph traversal query by selecting the kind of entities she is searching, how these entities are connected to other entities in the graph, and which properties she would like to have in her result columns. The&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2025/01/21/sparnatural-shacl-configuration-manual-automated-off-the-shelf/">Sparnatural SHACL configuration : manual, automated, off-the-shelf</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><strong><a href="https://sparnatural.eu" target="_blank">Sparnatural</a></strong> is a knowledge graph visual browser made for end-users. The user is guided in the creation of her graph traversal query by selecting the kind of entities she is searching, how these entities are connected to other entities in the graph, and which properties she would like to have in her result columns.</p>
<p>The possible entities, connections and properties that are shown to the user need to be specified to Sparnatural. This configuration is written in a <a href="https://docs.sparnatural.eu/how-to-configure-shacl/How-to-configure-Sparnatural-shacl.html" target="_blank">SHACL specification</a>. This specification encodes both the structure of the knowledge graph (as we want it to be presented to the user), plus some additionnal UI-oriented information, like icons, order of entries, or value selection widgets to use.</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/01/sparnatural-dbpedia-2.webm.gif"><img class="aligncenter size-full wp-image-1853" src="https://blog.sparna.fr/wp-content/uploads/2025/01/sparnatural-dbpedia-2.webm.gif" alt="sparnatural-dbpedia-2.webm" /></a></p>
<p>How can the SHACL configuration of Sparnatural be produced ? we faced 3 different situations : either we do it manually, or (semi-)automatically, or with an off-the-shelf specification complemented with manual annotations. We will give you a brief description of each possibility below.</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/01/image-20241013221653603.png"><img class="aligncenter wp-image-1845 size-large" src="https://blog.sparna.fr/wp-content/uploads/2025/01/image-20241013221653603-1024x576.png" alt="image-20241013221653603" width="650" height="366" /></a></p>
<h3>Write your SHACL manually (in Excel)</h3>
<p>SHACL has one main disadvantage : there is no widely available, free-to-use SHACL editor to create/edit these specs (while <a href="https://protege.stanford.edu/" target="_blank">Protégé</a>, for example, allows anyone to edit an OWL ontology). To overcome this lack of tool, we are using an Excel-to-SHACL conversion tool, xls2rdf. We (and our users) write the specification in an <a href="https://docs.google.com/spreadsheets/d/1lduSARo-zyL8qxObwPVD4Z2m8iKQpye-" target="_blank">Excel template</a>, that is then turned in SHACL by an API call to <a href="https://xls2rdf.sparna.fr/rest/" target="_blank">xls2rdf</a>. This is what we described in a <a href="https://blog.sparna.fr/2024/10/15/sparnatural-say-it-with-shacl/" target="_blank">previous post</a>.</p>
<p>We have a good documentation on <a href="https://docs.sparnatural.eu/how-to-configure-shacl/How-to-configure-Sparnatural-shacl.html" target="_blank">how to design your Sparnatural documentation in Excel</a>, if you want to try it (but see the <a href="https://docs.sparnatural.eu/hello-sparnatural/Hello-Sparnatural.html" target="_blank">Hello Sparnatural tutorial</a> first to setup your working test page). And we are here to help if you need to ! (ask questions on the <a href="https://github.com/sparna-git/Sparnatural" target="_blank">Github repository</a>).</p>
<p>If you are looking for a general-purpose SHACL Excel template, there is <a href="https://shacl-play.sparna.fr/play/shaclexcel">one in SHACL Play</a>.</p>
<h3>Get your SHACL automatically (statistics included)</h3>
<p>SHACL is machine-readable and also writable, so we can use our <a href="https://shacl-play.sparna.fr/play/generate#documentation">SHACL generation algorithm</a> to produce a SHACL &laquo;&nbsp;profile&nbsp;&raquo; of an RDF dataset. The algorithm sends SPARQL queries to identify all classes and properties, with their range, cardinalities, datatype, etc. This SHACL profile can be fed to Sparnatural directly. With an additionnal bonus : it is also very useful to gather <strong>statistics</strong> of the dataset at this stage. Number of instances of each class, number of occurrences of each property and number of distinct values. Why is it useful ? first because Sparnatural is able to show them in the UI, giving a hint to the user on how many entities of each type exist in the dataset:</p>
<p><a href="https://blog.sparna.fr/wp-content/uploads/2025/01/Capture-d’écran-du-2025-01-18-15-18-31.png"><img class="aligncenter size-full wp-image-1847" src="https://blog.sparna.fr/wp-content/uploads/2025/01/Capture-d’écran-du-2025-01-18-15-18-31.png" alt="Capture d’écran du 2025-01-18 15-18-31" width="695" height="460" /></a></p>
<p>second because by knowing how many distinct values exist for a given property, Sparnatural can show either a dropdown list (if there are less than 500) or an autocomplete search field (if there are more).</p>
<p>Also, as a side effect, seeing the profile and statistics of your dataset can help you spot errors (<em>&laquo;&nbsp;why does the statistics tells me that this identifier is not always present ? it should be mandatory !&nbsp;&raquo;</em>).</p>
<p>You can also provide the OWL ontology to Sparnatural along with the SHACL specification. Simply pass the 2 files in the configuration of the component. The ontology can be leveraged for 2 things : the hierarchy of classes and properties from the ontology can be used in the Sparnatural UI, and all labels and comments of classes and properties can be read to be displayed in the UI, giving nice defaults if they are not present in the SHACL spec.<br />
This automated SHACL generation was the one used for the <a href="https://www.nakala.fr/sparnatural/">Nakala Sparnatural query interface</a>, and here is how the properties look like, you can see it is organized according to the DublinCore properties hierarchy:</p>
<h3><a href="https://blog.sparna.fr/wp-content/uploads/2025/01/sparnatural-hierarchy.gif"><img class="aligncenter size-full wp-image-1848" src="https://blog.sparna.fr/wp-content/uploads/2025/01/sparnatural-hierarchy.gif" alt="sparnatural-hierarchy" width="640" height="343" /></a>Grab an off-the-shelf SHACL specification</h3>
<p>Some clients do write and publish SHACL specifications. Yes. This is the case for example for the <a href="https://data.europarl.europa.eu/en/developer-corner">European Parliament in their open-data portal</a>. They publish the documentation of their data-model with our <a href="https://shacl-play.sparna.fr/play/doc">SHACL Play documentation generator</a>. The specification existed long before we tried Sparnatural on their data. We simply took their specification, loaded it in Sparnatural and&#8230; voilà ! it worked seamlessly, but to make it nicer we added in a separate file additionnal icons and tooltips information.</p>
<h3>SHACL Synergies</h3>
<p>There is a lot of synergies to find with a SHACL configuration in a model-driven perspective. You can publish the documentation, validate data, power your Sparnatural UI, and generate your API JSON schema from the same specification file. And probably much more &#8211; what would YOU do with a SHACL specification of your knowledge graph ?</p>
<p>&nbsp;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2025/01/21/sparnatural-shacl-configuration-manual-automated-off-the-shelf/">Sparnatural SHACL configuration : manual, automated, off-the-shelf</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2025/01/21/sparnatural-shacl-configuration-manual-automated-off-the-shelf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sparnatural à SemWeb.pro 2022 le 8 novembre</title>
		<link>https://blog.sparna.fr/2022/10/31/sparnatural-a-semweb-pro-2022-le-8-novembre/</link>
		<comments>https://blog.sparna.fr/2022/10/31/sparnatural-a-semweb-pro-2022-le-8-novembre/#comments</comments>
		<pubDate>Mon, 31 Oct 2022 08:57:34 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[Sparnatural]]></category>
		<category><![CDATA[RDF SPARQL Sparnatural]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1536</guid>
		<description><![CDATA[<p>Le 8 novembre prochain se tient l&#8217;évènement semweb.pro 2022. J&#8217;y présenterai Sparnatural et les démonstrateurs des Archives Nationales de France et de la Bibliothèque Nationale de France réalisés en 2022. Ce sera un plaisir de vous y voir ! Après la conférence les supports seront à retrouver sur la section &#171;&#160;bibliographie&#160;&#187; du site. J&#8217;en profite&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/10/31/sparnatural-a-semweb-pro-2022-le-8-novembre/">Sparnatural à SemWeb.pro 2022 le 8 novembre</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Le 8 novembre prochain se tient l&rsquo;évènement <a href="https://2022.semweb.pro/"><strong>semweb.pro 2022</strong></a>. J&rsquo;y présenterai <a href="https://sparnatural.eu">Sparnatural</a> et les <a href="https://sparna-git.github.io/sparnatural-demonstrateur-an/">démonstrateurs des Archives Nationales de France</a> et de la <a href="https://data.bnf.fr/sparnatural/">Bibliothèque Nationale de France</a> réalisés en 2022. Ce sera un plaisir de vous y voir !</p>
<p>Après la conférence les supports seront à retrouver sur la <a href="https://sparnatural.eu/#bibliography">section &laquo;&nbsp;bibliographie&nbsp;&raquo; du site</a>.</p>
<p>J&rsquo;en profite pour vous indiquer les 2 dernières démos mises au point avec Sparnatural :</p>
<ul>
<li><a href="https://sparnatural.eu/demos/demo-partitions/">Recherche sur les partitions musicales</a> de la <a href="https://www.citedelamusique.fr">Cité de la Musique / Philharmonie de Paris</a>, modélisées avec FRBRoo + Doremus, pour le projet <em>ScoreBot</em> (chatbot de recherche sur des partitions musicales)</li>
<li><a href="https://sparnatural.eu/demos/demo-smt-med/">Recherche/navigation sur la maquette du référentiel d&rsquo;interopérabilité du médicament</a>. Ce référentiel est <a href="https://smt.esante.gouv.fr/explorer-les-concepts/terminologie-ref_interop_med/">publié sur le SMT de l&rsquo;ANS</a>.</li>
</ul>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/10/31/sparnatural-a-semweb-pro-2022-le-8-novembre/">Sparnatural à SemWeb.pro 2022 le 8 novembre</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/10/31/sparnatural-a-semweb-pro-2022-le-8-novembre/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dashboards from SPARQL knowledge graphs using Looker Studio (Google Data Studio)</title>
		<link>https://blog.sparna.fr/2022/10/18/dashboards-from-sparql-knowledge-graphs-using-looker-studio-google-data-studio/</link>
		<comments>https://blog.sparna.fr/2022/10/18/dashboards-from-sparql-knowledge-graphs-using-looker-studio-google-data-studio/#comments</comments>
		<pubDate>Tue, 18 Oct 2022 13:02:38 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[02-Outils]]></category>
		<category><![CDATA[SPARQL]]></category>
		<category><![CDATA[dashboards]]></category>
		<category><![CDATA[RDF]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1481</guid>
		<description><![CDATA[<p>You want to demonstrate the content of your knowledge graph accessible in SPARQL ? You can easily use dashboard tools, such as Looker studio  (formerly Google Data Studio) which require no development and is free to use. Of course, Sparnatural is another possible solution ! This guide will describe every step you need to know&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/10/18/dashboards-from-sparql-knowledge-graphs-using-looker-studio-google-data-studio/">Dashboards from SPARQL knowledge graphs using Looker Studio (Google Data Studio)</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><span style="font-weight: 400;">You want to demonstrate the content of your <strong>knowledge graph accessible in SPARQL</strong> ? You can easily use <strong>dashboard</strong> tools, such as <a href="https://datastudio.google.com" target="_blank">Looker studio</a>  (formerly </span><span style="font-weight: 400;">Google Data Studio</span><span style="font-weight: 400;">) which require no development and is free to use. Of course, </span><a href="https://sparnatural.eu" target="_blank"><span style="font-weight: 400;">Sparnatural</span></a><span style="font-weight: 400;"> is another possible solution !</span></p>
<p><span style="font-weight: 400;">This guide will describe every step you need to know in order to create a Looker Studio Dashboard from SPARQL queries. All along, an example will be shown to illustrate all the steps with screenshots, code text and quotes</span><span style="font-weight: 400;">.</span></p>
<h1><span style="font-weight: 400;">Step 1 : Getting the SPARQL Connector </span></h1>
<p><span style="font-weight: 400;">Looker Studio does not provide any native connector for SPARQL. But a community connector exists, called SPARQL Connector, made by Datafabrics LLC, that can be used to create the data source. You can find it by searching for community connectors, or use </span><a href="https://datastudio.google.com/datasources/create?connectorId=AKfycbzDHEBN9qHXPni4xO4P2cIZtyQ3rnYmzkCnVsnh9oEJrnhGe4MntBF-t1zAu2Lm-Vjc" target="_blank"><span style="font-weight: 400;">this link</span></a><span style="font-weight: 400;">. The code is available in </span><a href="https://github.com/DataFabricRus/datastudio-sparql-connector" target="_blank"><span style="font-weight: 400;">this Github repository</span></a><span style="font-weight: 400;">.</span></p>
<p><span style="font-weight: 400;">You have to grant access to your Google account for SPARQL Connector before using it. You will be able to find it in the connectors panel, in the Partner Connectors section, for your next queries.</span></p>
<h1><span style="font-weight: 400;">Step 2 : Connect your knowledge graph</span></h1>
<p><span style="font-weight: 400;">From your report, click on “Add Data” on the bottom right of the screen to open the connector panel. Select the SPARQL Connector in the connector panel (you can also search for it by entering “sparql” in the research field).</span><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/1-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1491" src="http://blog.sparna.fr/wp-content/uploads/2022/10/1-article-Dashboard-300x150.jpg" alt="1 - article Dashboard" width="300" height="150" /></a></p>
<p><span style="font-weight: 400;">Then, follow the steps to create your own data source:</span></p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Enter the URL of the SPARQL endpoint (the endpoint must be publicly accessible, without authentication)</span>, for example, with DBPedia:</li>
</ul>
<pre><span style="font-size: 10pt;"><code><span style="font-weight: 400;">https://dbpedia.org/sparql</span></code></span></pre>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Then enter the SPARQL query, for example the following selects countries, their capital city label and their total population:<br />
</span></li>
</ul>
<pre><span style="font-size: 10pt;"><code><span style="font-weight: 400;">PREFIX rdfs: &lt;</span><span style="font-weight: 400;">http://www.w3.org/2000/01/rdf-schema#</span><span style="font-weight: 400;">&gt;</span>
<span style="font-weight: 400;">PREFIX dbr: &lt;</span><span style="font-weight: 400;">http://dbpedia.org/resource/</span><span style="font-weight: 400;">&gt;</span>
<span style="font-weight: 400;">PREFIX dbo: &lt;http://dbpedia.org/ontology/&gt;</span>
<span style="font-weight: 400;">SELECT ?capital_city_label ?country_label  ?population</span>
<span style="font-weight: 400;">WHERE {</span>
<span style="font-weight: 400;">?capital_city  dbo:type dbr:Capital_city.</span>
<span style="font-weight: 400;">?capital_city rdfs:label ?capital_city_label.</span>
<span style="font-weight: 400;">?capital_city dbo:country ?country.</span>
<span style="font-weight: 400;">?country rdfs:label ?country_label.</span>
<span style="font-weight: 400;">OPTIONAL {?capital_city dbo:populationMetro ?population.}</span>
<span style="font-weight: 400;">FILTER (lang(?capital_city_label) = 'en')</span>
<span style="font-weight: 400;">FILTER (lang(?country_label) = 'en')</span>
<span style="font-weight: 400;">}</span></code></span></pre>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">For each field on your query, you have to create one field on your data source and select its type. To do so, you have to build a schema like this one:<br />
</span></li>
</ul>
<pre><span style="font-size: 10pt;"><code><span style="font-weight: 400;">[{"name": "capital_city_label", "dataType": "STRING"},</span>
<span style="font-weight: 400;">    {"name": "country_label", "dataType": "STRING"},</span>
<span style="font-weight: 400;">    {"name": "population", "dataType": "NUMBER"}]</span></code></span></pre>
<p><span style="font-weight: 400;">Be sure your “name” fields match the fields you have on your query in the same order. You have to select the “dataType” you want for each of your fields, but you can change it later within Google Data Studio. Click </span><a href="https://support.google.com/looker-studio/answer/9514333?hl=en" target="_blank"><span style="font-weight: 400;">here</span></a><span style="font-weight: 400;"> to learn more about data types.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/2-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1492" src="http://blog.sparna.fr/wp-content/uploads/2022/10/2-article-Dashboard-300x173.jpg" alt="2 - article Dashboard" width="300" height="173" /></a></p>
<p><span style="font-weight: 400;">Once every field is completed, you have to click twice on “Add”. If everything goes well, the connector panel will disappear and your new data source will appear on the right of the window and is ready to use. It is defaultly named as “SPARQL Connector”.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/3-article-Dashboard.jpg"><img class="aligncenter size-full wp-image-1493" src="http://blog.sparna.fr/wp-content/uploads/2022/10/3-article-Dashboard.jpg" alt="3 - article Dashboard" width="229" height="183" /></a></p>
<p><span style="font-weight: 400;">If you made a mistake while creating your data source, the SPARQL Connector panel can :</span></p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Show an error message, that will indicate you the error type (endpoint, for example)</span></li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/4-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1494" src="http://blog.sparna.fr/wp-content/uploads/2022/10/4-article-Dashboard-300x212.jpg" alt="4 - article Dashboard" width="300" height="212" /></a></p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Do nothing and you will have to check on your schema to be sure everything is correct.</span></li>
</ul>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Create a data source as it should do, but Google Data Studio can’t use your data source, and show you this message on your chart :</span></li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/5-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1495" src="http://blog.sparna.fr/wp-content/uploads/2022/10/5-article-Dashboard-300x177.jpg" alt="5 - article Dashboard" width="300" height="177" /></a></p>
<p><span style="font-weight: 400;">If you click on “See details” Google Data Studio will show you the error type from the connector :</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/6-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1496" src="http://blog.sparna.fr/wp-content/uploads/2022/10/6-article-Dashboard-300x210.jpg" alt="6 - article Dashboard" width="300" height="210" /></a></p>
<h1><span style="font-weight: 400;">Step 3 : Transform your data</span><span style="font-weight: 400;"> </span></h1>
<p><span style="font-weight: 400;">First, you can change the name of your data source by clicking on the icon on the left of the data source on Google Data Studio (the icon will change into a pencil) to open the data source edition panel.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/7-article-Dashboard.jpg"><img class="aligncenter size-full wp-image-1497" src="http://blog.sparna.fr/wp-content/uploads/2022/10/7-article-Dashboard.jpg" alt="7 - article Dashboard" width="235" height="184" /></a></p>
<p><span style="font-weight: 400;">Then, click on the top left of the new panel where the name of your data source is to modify it.</span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Change name of the example data source to “Capital city Data (DBpedia)”</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/8-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1498" src="http://blog.sparna.fr/wp-content/uploads/2022/10/8-article-Dashboard-300x171.jpg" alt="8 - article Dashboard" width="300" height="171" /></a></p>
<p><span style="font-weight: 400;">You can also change your data source by modifying your parameters in SPARQL Connector. To do so, click on “EDIT CONNECTION”. The SPARQL Connector panel will open with your current parameters and you can modify them.</span></p>
<p><span style="font-weight: 400;">In the data source edition panel, you can also change the type of your fields so it fits your needs (numbers can be changed as currency, text can be changed as geographic data, etc.).</span></p>
<p><span style="font-weight: 400;">Be careful of your fields format, you may not be able to use your data anymore. For example, if you have a “,” as a decimal separator, you can change your data type but you won’t be able to use this field as Google Data Studio uses “.” as a decimal separator.</span></p>
<p><span style="font-weight: 400;">The connector will also apply default values in query results which don&rsquo;t have a value for a requested field. The default values are 0 for numbers, “” for strings and false for booleans.</span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">The population field on DBpedia has some null values, but the connector transformed all these values into default values (0 for numbers).</span></p></blockquote>
<p><span style="font-weight: 400;">You may need to use calculated fields in order to obtain new fields or to transform data. To create one,  click on “ADD A FIELD” on the right side of the same panel. Check the </span><a href="https://support.google.com/datastudio/answer/6299685?hl=en#zippy=%2Cin-this-article" target="_blank"><span style="font-weight: 400;">following page from the documentation</span></a><span style="font-weight: 400;"> to learn more about calculated fields.</span></p>
<p><span style="font-weight: 400;">By using a calculated field, the population data can be switched back to the original values.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/9-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1499" src="http://blog.sparna.fr/wp-content/uploads/2022/10/9-article-Dashboard-300x47.jpg" alt="9 - article Dashboard" width="300" height="47" /></a></p>
<p><span style="font-weight: 400;">In the new panel, choose the name of your new field, enter the formula. To ensure your formula is correct, a green check appears at the bottom of the panel. If not, it will turn into a red cross.</span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Enter the new field name: &laquo;&nbsp;population_recalculated&nbsp;&raquo;. Then enter the formula of the field : &laquo;&nbsp;NULLIF(population,0)&nbsp;&raquo;. In this case, if any population value is equal to 0 in the population field, it will turn into a null value in the calculated field. </span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/10-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1500" src="http://blog.sparna.fr/wp-content/uploads/2022/10/10-article-Dashboard-300x222.jpg" alt="10 - article Dashboard" width="300" height="222" /></a></p>
<h1><span style="font-weight: 400;">Step 4 : Improve performance with data extraction</span></h1>
<p><span style="font-weight: 400;">Once you manage to create all your calculated fields, you may have some useless fields in your data source. Those fields may decrease the speed of your dashboard. You can use the “Extract Data” to keep the fields you need in another data source that you will use to make your report.</span></p>
<p><span style="font-weight: 400;">To use it, click on “Add Data” on the bottom right of the screen and select “Extract Data”.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/20-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1510" src="http://blog.sparna.fr/wp-content/uploads/2022/10/20-article-Dashboard-300x125.jpg" alt="20 - article Dashboard" width="300" height="125" /></a></p>
<p><span style="font-weight: 400;">Then, select your data source and the fields you want to keep in your report. You can make many extractions from one data source if you need. </span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Choose the data source and keep only 3 fields : “capital_city_label”, “country_label” and “population_recalculated”.</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/11-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1501" src="http://blog.sparna.fr/wp-content/uploads/2022/10/11-article-Dashboard-273x300.jpg" alt="11 - article Dashboard" width="273" height="300" /></a></p>
<p><span style="font-weight: 400;">You can also configure the auto-update tool to make sure your extracted data are up to date with the latest version of your data source from SPARQL Connector. In the bottom right of the panel, switch the auto-update button then choose the occurrence of the update (between daily, weekly and monthly).</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/12-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1502" src="http://blog.sparna.fr/wp-content/uploads/2022/10/12-article-Dashboard-300x266.jpg" alt="12 - article Dashboard" width="300" height="266" /></a></p>
<p><span style="font-weight: 400;">A data source defaultly named “Extract Data” appears with the fields you selected from the previous data source.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/13-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1503" src="http://blog.sparna.fr/wp-content/uploads/2022/10/13-article-Dashboard-205x300.jpg" alt="13 - article Dashboard" width="205" height="300" /></a></p>
<p><span style="font-weight: 400;">This method only works for data sources, you won’t be able to use it on blended data. Make sure to do the extraction before blending to improve your performance. To learn more about blending, see </span><a href="https://support.google.com/datastudio/answer/9061420?hl=en" target="_blank"><span style="font-weight: 400;">this page</span></a><span style="font-weight: 400;"> from the Looker Studio documentation</span><span style="font-weight: 400;">.</span></p>
<h1><span style="font-weight: 400;">Step 5 : Create your dashboard </span></h1>
<p><span style="font-weight: 400;">Here is a quick guide on how to create a chart in Google Data Studio. Check the </span><a href="https://support.google.com/datastudio/topic/7059081" target="_blank"><span style="font-weight: 400;">chart reference documentation</span></a><span style="font-weight: 400;"> for more information about charts available by default.</span></p>
<p><span style="font-weight: 400;">To build a dashboard, you will need to select a widget first (pie chart, table, histograms, etc.). Click on “Add a chart” on the top of the screen and select the one you need.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/14-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1504" src="http://blog.sparna.fr/wp-content/uploads/2022/10/14-article-Dashboard-300x42.jpg" alt="14 - article Dashboard" width="300" height="42" /></a></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Click on “Add a chart” and select a pie chart.</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/15-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1505" src="http://blog.sparna.fr/wp-content/uploads/2022/10/15-article-Dashboard-281x300.jpg" alt="15 - article Dashboard" width="281" height="300" /></a></p>
<p><span style="font-weight: 400;">Select your chart on the report, it will open a panel on the right side of the screen where you can see the chart type and modify it. You can select the data to display in the “SETUP” panel. You can also customize the chart with the “STYLE” panel.</span></p>
<p><span style="font-weight: 400;">Place the chart on your dashboard anywhere you want to see it. Google Data Studio will automatically choose the data source and some fields which fit the charts, but you can choose to modify them in the “SETUP” panel on the right.</span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Choose “capital_city_label” as dimension and “population recalculated” as metric.</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/16-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1506" src="http://blog.sparna.fr/wp-content/uploads/2022/10/16-article-Dashboard-153x300.jpg" alt="16 - article Dashboard" width="153" height="300" /></a></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Here is the result of this configuration :</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/17-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1507" src="http://blog.sparna.fr/wp-content/uploads/2022/10/17-article-Dashboard-300x224.jpg" alt="17 - article Dashboard" width="300" height="224" /></a></p>
<p><span style="font-weight: 400;">In the “STYLE” panel, you can choose to modify some options in the chart to customize it.</span></p>
<blockquote><p><span style="font-weight: 400; font-size: 12pt;">Change the number of slices from 10 to 6 to see the 5 top values + others value.</span></p></blockquote>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/18-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1508" src="http://blog.sparna.fr/wp-content/uploads/2022/10/18-article-Dashboard-172x300.jpg" alt="18 - article Dashboard" width="172" height="300" /></a></p>
<p><span style="font-weight: 400;">The chart will change automatically with your new parameters as you change them.</span></p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/10/19-article-Dashboard.jpg"><img class="aligncenter size-medium wp-image-1509" src="http://blog.sparna.fr/wp-content/uploads/2022/10/19-article-Dashboard-300x238.jpg" alt="19 - article Dashboard" width="300" height="238" /></a></p>
<p><span style="font-weight: 400;">Congratulations, you have successfully made your first chart!Try to get your own data sources with SPARQL Connector, make your own dashboards with Looker Studio, and send us the links !</span></p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/10/18/dashboards-from-sparql-knowledge-graphs-using-looker-studio-google-data-studio/">Dashboards from SPARQL knowledge graphs using Looker Studio (Google Data Studio)</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/10/18/dashboards-from-sparql-knowledge-graphs-using-looker-studio-google-data-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clean JSON(-LD) from RDF using Framing</title>
		<link>https://blog.sparna.fr/2022/07/20/clean-json-ld-from-rdf-using-framing/</link>
		<comments>https://blog.sparna.fr/2022/07/20/clean-json-ld-from-rdf-using-framing/#comments</comments>
		<pubDate>Wed, 20 Jul 2022 06:56:36 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[Linked Data]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[SHACL Play]]></category>
		<category><![CDATA[Framing]]></category>
		<category><![CDATA[json-ld]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1462</guid>
		<description><![CDATA[<p>Say you have a nice RDF knowledge graph based on an ontology, or maybe reusing ontologies, and maybe you have specified the structure of the knowledge graph with SHACL. And now you would like to expose your RDF in JSON in an API, for the average developer (or maybe you would like to produce a&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/07/20/clean-json-ld-from-rdf-using-framing/">Clean JSON(-LD) from RDF using Framing</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Say you have a nice RDF knowledge graph based on an ontology, or maybe reusing ontologies, and maybe you have specified the structure of the knowledge graph with SHACL. And now you would like to <strong>expose your RDF in JSON</strong> in an API, for the average developer (or maybe you would like to produce a clean JSON to be indexed by Elastic). And the average developer (or Elastic) does not care about RDF and does not care about the “-LD” in “JSON-LD”, he just cares about JSON; and he is right ! we are here to care about the “-LD” part for him.</p>
<p>So what you need is to produce a clean JSON structure from your raw RDF triples. And when I mean “clean”, I mean :</p>
<ul>
<li><strong>no URIs</strong>. Nowhere. No URIs in JSON keys, No URIs in types of entities, no URIs in the value of properties controlled by a closed list; the only places where it is acceptable to see a URI are : to give the id of the entities, and when making a reference to such an id of entity within the graph; even in these cases the URIs can be shortened.</li>
<li><strong>no fancy JSON-LD keys</strong> like @type, @value, @datatype, @id, etc.</li>
<li><strong>indented</strong>.</li>
</ul>
<p>You have 2 possibilities to do that :</p>
<ol>
<li>You develop a custom script, to either generate a JSON export of your data, or to implement the API that will query the knowledge graph, parse the triples, and generate that clean JSON output.</li>
<li>You use <strong><a href="https://www.w3.org/TR/json-ld11-framing/">JSON-LD framing</a> to automate the production of a clean JSON(-LD) from RDF</strong>.</li>
</ol>
<p>There are 2 nice things about the solution with JSON-LD framing :</p>
<ol>
<li>it can be automated</li>
<li>you automatically retain the RDF compatibility &#8211; because your JSON will necessarily be JSON-LD. This means you can import your nice JSON directly in a triplestore.</li>
</ol>
<p>The principle of JSON-LD framing is that you provide a <a href="https://www.w3.org/TR/json-ld/#the-context">JSON-LD @context </a>with an additionnal <a href="https://www.w3.org/TR/json-ld11-framing/#framing">frame specification</a> that defines how the JSON should be structured (indented), which entity to include at each level (entities can be filtered based on some criteria), and also which properties to include in each entity.</p>
<p>To start with JSON-LD framing, what you need is JSON-LD. Any JSON-LD. Typically the raw JSON-LD serialization that any RDF library or triplestore will produce; that kind of ugly, messy, full-of-URIs-and-@language kind of JSON. So something like:</p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/07/Capture-d’écran-du-2022-07-19-17-30-45.png"><img class="aligncenter size-large wp-image-1465" src="http://blog.sparna.fr/wp-content/uploads/2022/07/Capture-d’écran-du-2022-07-19-17-30-45-1024x658.png" alt="Capture d’écran du 2022-07-19 17-30-45" width="650" height="418" /></a></p>
<p><em>(Brrr, scary, no ?)</em></p>
<p>And then what you need is the <a href="https://json-ld.org/playground/">JSON-LD playground</a> with the “Framed” tab. This will allow you to test your context and frame specification.</p>
<p>And when deployed in production, what you will need is a JSON-LD library that is capable of implementing the JSON-LD framing algorithm. Implementations are listed <a href="https://json-ld.org/#developers">here</a>, and you need an implementation compatible with JSON-LD 1.1.</p>
<h2>Example files</h2>
<p>As an example, I use a JSON-LD file from the French National Library, the one from Les Misérables here : <a href="https://data.bnf.fr/fr/13516296/victor_hugo_les_miserables/">https://data.bnf.fr/fr/13516296/victor_hugo_les_miserables/</a> (download link at the bottom of the page).</p>
<p><strong>You can download <a href="http://blog.sparna.fr/wp-content/uploads/2022/07/les_miserables_jsonld_framing_example.zip">the initial JSON example, the frame specification, and the result in a zip</a>.</strong> The zip also contains intermediate frame specifications.</p>
<h2>The @context</h2>
<p>We&rsquo;ll start by specifying the JSON-LD context part.</p>
<h3><b>Map @type to type and @id to id</b></h3>
<p>Average developer will wonder what are those @type and @id keys. Re-map them straight away to type and id:</p>
<blockquote><p><code>"type" : "@type",<br />
"id" : "@id",<br />
</code></p></blockquote>
<p>Schema.org and lot of other specifications do that.</p>
<h3><b>What about @graph ?<br />
</b></h3>
<p>If you have a named graph at the top, introduced by @graph, my suggestion would be to simply remap it to a fixed key, like &laquo;&nbsp;data&nbsp;&raquo;, or &laquo;&nbsp;entities&nbsp;&raquo; :</p>
<blockquote><p><code>"data" : "@graph",<br />
</code></p></blockquote>
<h3><b>Map RDF properties URIs to JSON keys</b></h3>
<p>Get rid of any trace of URI or short URIs in JSON keys. Declare a term for every property in your graph. The simplest way to do this is to use the local part of the URI (after last “#” or “/”) as the term. Order the context by the alphabetical order of the terms. Terms for properties will usually start with a lowercase letter.</p>
<p>In corner cases you may end up with the same term (such as in the example bnf-onto:subject and dcterms:subject), so in that case you need a different key, I chose “bnf-subject” here for bnf-onto:subject and kept “subject” for dcterms:subject.</p>
<blockquote><p><code>"creator" : "dcterms:creator",<br />
"date" : "dcterms:date",<br />
"dateOfWork" : "rdagroup1elements:dateOfWork",<br />
"depiction" : "foaf:depiction",<br />
"description" : "dcterms:description",<br />
</code></p></blockquote>
<h3><b>Map classes URIs to JSON terms</b></h3>
<p>Now you want to do the same thing to get rid of any trace of URIs in the “type” of entities. Declare a term for every class in your ontology/application profile. List the classes in a different section than the properties. Terms for classes will usually start with an uppercase.</p>
<blockquote><p><code>"Concept" : "skos:Concept",<br />
"Document" : "foaf:Document",<br />
"ExpositionVirtuelle" : "bnf-onto:ExpositionVirtuelle",<br />
</code></p></blockquote>
<h3> <b>Declare object properties with “@type”: “@id”</b></h3>
<p>Now you want to get rid of all those ugly “id”, we are only interested in listing the values. To do that, modify the mapping of the property (here “depiction”) to state its values are URIs. You need to change the mapping from</p>
<blockquote><p><code>"depiction" : "foaf:depiction",</code></p></blockquote>
<p>to</p>
<blockquote><p><code>"depiction" : { "@value" : "foaf:depiction", "@type":"@id" },</code></p></blockquote>
<p>And so parts like this :</p>
<blockquote><p><code>"depiction": [<br />
{<br />
"id": "https://gallica.bnf.fr/ark:/12148/btv1b8438568p.thumbnail"<br />
},<br />
{<br />
"id": "https://gallica.bnf.fr/ark:/12148/btv1b9004781d.thumbnail"<br />
},<br />
{<br />
"id": "https://gallica.bnf.fr/ark:/12148/bpt6k5545348q.thumbnail"<br />
}<br />
]</code></p></blockquote>
<p>Will be turned into</p>
<blockquote><p><code> "depiction": [<br />
"https://gallica.bnf.fr/ark:/12148/btv1b8438568p.thumbnail",<br />
"https://gallica.bnf.fr/ark:/12148/btv1b9004781d.thumbnail",<br />
"https://gallica.bnf.fr/ark:/12148/bpt6k5545348q.thumbnail",<br />
"https://gallica.bnf.fr/ark:/12148/btv1b8438570r.thumbnail"<br />
]</code></p></blockquote>
<h3><b>Map datatypes</b></h3>
<p>Now you want to get rid of the @datatype information for literals. If the value of a property always uses the same datatype, which is the case 99,9% of the time, then you can change the mapping from</p>
<blockquote><p><code>"property" : "http://myproperty",</code></p></blockquote>
<p>to</p>
<blockquote><p><code>"property" : { “@id”: "http://myproperty", “@type”:”xsd:date” }</code></p></blockquote>
<p>(The example used does not have datatype properties.)</p>
<h3><b>Map languages, with fixed language or when multilingual</b></h3>
<p>Now let’s get rid of the @language. For this you have 2 choices : when the language is always the same for the value, you can indicate it in the context, the same way that you would do for the datatype but with the @language key. So you change from</p>
<blockquote><p><code>"description" : "dcterms:description",</code></p></blockquote>
<p>to</p>
<blockquote><p><code>"description" : { “@id” : "dcterms:description", “@language” : “fr” }</code></p></blockquote>
<p>You could even have different terms for different languages, such as :</p>
<blockquote><p><code>"title_fr" : { "@id" : "dcterms:title", "@language" : "fr" },<br />
"title_en" : { "@id" : "dcterms:title", "@language" : "en" },<br />
"title" : { "@id" : "dcterms:title" },</code></p></blockquote>
<p>or when you have multilingual multiple values, you can make the property a language map by declaring it this way:</p>
<blockquote><p><code>"editorialNote" : { "@id" : "skos:editorialNote", "@container" : "@language" },</code></p></blockquote>
<p>Which will turn the language code as a key in the JSON output:</p>
<blockquote><p><code>"editorialNote": {<br />
"fr": [<br />
"BN Cat. gén. (sous : Hugo, comte Victor-Marie) : Les misérables. - . - BN Cat. gén. 1960-1969 (sous : Hugo, Victor) : idem. - . -",<br />
"Laffont-Bompiani, Oeuvres, 1994. - . - GDEL. - . -"<br />
]
},</code></p></blockquote>
<p>In that case, watch out for cases where there is a value without language, it will generate a @none key.</p>
<h3><b>Map controlled list values to JSON terms</b></h3>
<p>By now you already get a much cleaner JSON and almost all “unnecessary” URIs have disappeared. But we still have some URI references that we can clean up : the ones that are references to controlled lists with a finite number of values.</p>
<p>We can declare term mappings for those values just like we did to map properties and classes. BUT &#8211; and this is the trick, <strong>we need to change the property declaration from “@id” to “@vocab” for the replacement to happen</strong>. This is documented in the <a href="https://www.w3.org/TR/json-ld/#type-coercion">&laquo;&nbsp;Type coercion&nbsp;&raquo; section of the spec</a>.</p>
<p>In our example, the mapping to languages and subjects are good candidates to be mapped to JSON terms. So we change</p>
<blockquote><p><code>"language" : { "@id" : "dcterms:language", "@type":"@id" },<br />
"subject" : { "@id" : "dcterms:subject", "@type":"@id" },<br />
</code></p></blockquote>
<p>to</p>
<blockquote><p><code>"language" : { "@id" : "dcterms:language", "@type":"@vocab" },<br />
"subject" : { "@id" : "dcterms:subject", "@type":"@vocab" },<br />
“fre” : “http://id.loc.gov/vocabulary/iso639-2/fre”,<br />
“eng” : “http://id.loc.gov/vocabulary/iso639-2/eng”,</code></p></blockquote>
<h3><b>Shorten remaining URI references<br />
</b></h3>
<p>Now the only URIs left are the ids of the main entities in our graph, and references to those ids. Reference to controlled vocabularies with a limited number of values have been mapped to JSON terms. Although we cannot turn all the remaining URIs to JSON terms (because we can&rsquo;t declare all possible entity URIs in the context), we can shorten them by adding a prefix mapping in the context, in our case:</p>
<blockquote><p><code>"ark-https": "https://data.bnf.fr/ark:/12148/",<br />
</code></p></blockquote>
<p>(I note that there are http:// and https:// URIs in the data, I don&rsquo;t know why)</p>
<p>&nbsp;</p>
<h2>The frame specification</h2>
<p>So now we have clean values, no URIs, no fancy JSON-LD keys. But we still don’t have a structure indented the way the average developer would expect it; and this is where the frame specification comes into play.</p>
<h3><b>Define indentation and filters (and reverse properties if needed)<br />
</b></h3>
<p>The frame specification acts as both a filter/selection mechanism and as a structure definition. At each level you indicate the criterias for the object to be included. In our example we have a skos:Concept (the entry in the library catalog) that is foaf:focus a Work (the Book &laquo;&nbsp;in the real world&nbsp;&raquo;), and that skos:Concept is the subject of many virtual exhibits. We want to have the Concept and the Work at first level, and under the concept the exhibits. But there is a trick : it is the virtual exhibits that points to the concept with a dcterms:subject, and we want it the other direction : Concept is_subject_of Exhibit, so we need a @reverse property.</p>
<p>To do that, add the following reverse mapping declaration: (don&rsquo;t modify the existing one):</p>
<blockquote><p><code>"subject_of" : { "@reverse" : "dcterms:subject" },</code></p></blockquote>
<p>Note the use of &laquo;&nbsp;@reverse&nbsp;&raquo; to indicate that JSON key is to be interpreted from object to subject when turned into triples.</p>
<p>With that in place, we can write our frame specification, which goes right after the @context we have designed before:</p>
<blockquote><p><code>"type" : ["Concept", "Work"],<br />
"subject_of" : {<br />
"type" : "ExpositionVirtuelle"<br />
}</code></p></blockquote>
<p>Note how we use the terms defined in the context previously. This is to be understood the following way : <em>&laquo;&nbsp;at the first level, take any entity with a type of either Concept or Work, then insert a subject_of key and put inside any value that has a type ExpositionVirtuelle&nbsp;&raquo;</em>. This garantees the virtual exhibits objects will go under the Concept, and not above or at the same level. But this is not sufficient, as you will notice if you apply that framing that the Work is <strong>repeated</strong> under the &laquo;&nbsp;focus&nbsp;&raquo; property of the Concept, and at the root level. This is because of the default behavior of the JSON-LD playground regarding <a href="https://www.w3.org/TR/json-ld11-framing/#object-embed-flag">object embedding</a> (objects are always embeded when they are referenced)</p>
<h3><b>Avoid embedding</b></h3>
<p>To avoid embedding when it is undesired, we can set the &laquo;&nbsp;@embed&nbsp;&raquo; option to &laquo;&nbsp;@never&nbsp;&raquo; on the &laquo;&nbsp;focus&nbsp;&raquo; property, like so :</p>
<blockquote><p><code>"type" : ["Concept", "Work"],<br />
"subject_of" : {<br />
"type" : "ExpositionVirtuelle"<br />
},<br />
"focus" : {<br />
"@embed" : "@never",<br />
"@omitDefault": true<br />
}<br />
</code></p></blockquote>
<p>This tells the framing algorithm to never embed the complete entity inside the focus property, just reference the URI instead.</p>
<p>Also, you will notice the use of &laquo;&nbsp;@omitDefault&nbsp;&raquo; to true; this tells the framing algorithm to omit the focus property when it has no value. Otherwise, since the Work does not have a foaf:focus property (only the Concept), then it will get a &laquo;&nbsp;focus&nbsp;&raquo; key set to null.</p>
<h3><b>What about order of keys in the JSON ?</b></h3>
<p>Well, I am sure this can be controlled, either by specifying explicitely all the keys you want, in the order you want them, in the frame specification, or by using an &laquo;&nbsp;ordered&nbsp;&raquo; parameter to the JSON-LD API, but that is not available in the playground.</p>
<p>If you list all keys explicitely in the frame specification, don&rsquo;t forget to use wildcards so that any value will match; wildcards are empty objects with &laquo;&nbsp;{}&nbsp;&raquo;:</p>
<blockquote><p><code>"myProperty" : {}</code></p></blockquote>
<h2>The result</h2>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2022/07/Capture-d’écran-du-2022-07-20-08-01-19.png"><img class="aligncenter size-full wp-image-1475" src="http://blog.sparna.fr/wp-content/uploads/2022/07/Capture-d’écran-du-2022-07-20-08-01-19.png" alt="Capture d’écran du 2022-07-20 08-01-19" width="806" height="360" /></a></p>
<p>Much nicer no ? This is something you can put into the hand of an average developer.</p>
<h2>Automate context generation from SHACL</h2>
<p>Do you have a SHACL specification of the structure of your graph ? wouldn&rsquo;t it be nice to automate the generation of the JSON-LD context from SHACL ? Maybe we could do that in <a href="https://shacl-play.sparna.fr/play/">SHACL-Play</a> ? stay tuned !</p>
<p>Probably what we can automate is the context part, which can be global and unique for all your graph, but the framing specification should probably be different for each different API you need; each framing specification will then reference the same context by its URL.</p>
<p><em>Image : <a href="https://gallica.bnf.fr/ark:/12148/btv1b53230250h/f1.item.r=encadrement.zoom#"><span class="title">[Encadrement ornemental] ([1er état]) / .Io. MIGon 1544. [Jean Mignon] ; [d&rsquo;après Le Primatice]</span></a> <a href="https://gallica.bnf.fr/ark:/12148/btv1b53230250h">https://gallica.bnf.fr/ark:/12148/btv1b53230250h</a></em></p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/07/20/clean-json-ld-from-rdf-using-framing/">Clean JSON(-LD) from RDF using Framing</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/07/20/clean-json-ld-from-rdf-using-framing/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Evènement : Sparnatural et les démonstrateurs Archives Nationales + BNF</title>
		<link>https://blog.sparna.fr/2022/05/24/evenement-sparnatural-demonstrateurs-archives-nationales-bnf/</link>
		<comments>https://blog.sparna.fr/2022/05/24/evenement-sparnatural-demonstrateurs-archives-nationales-bnf/#comments</comments>
		<pubDate>Tue, 24 May 2022 07:48:02 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[Non classé]]></category>
		<category><![CDATA[LinkedData]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[RecordsInContexts]]></category>
		<category><![CDATA[Sparnatural]]></category>
		<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1456</guid>
		<description><![CDATA[<p>Les Archives nationales, la BnF et le Département du Numérique pour la transformation des politiques culturelles et l’administration des données (DEPNUM) du ministère de la Culture se sont associés en 2021 pour mener à bien un projet visant deux objectifs : développer une nouvelle version de Sparnatural (http://sparnatural.eu/), un éditeur open source de requêtes SPARQL (qui&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/05/24/evenement-sparnatural-demonstrateurs-archives-nationales-bnf/">Evènement : Sparnatural et les démonstrateurs Archives Nationales + BNF</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Les Archives nationales, la BnF et le Département du Numérique pour la transformation des politiques culturelles et l’administration des données (DEPNUM) du ministère de la Culture se sont associés en 2021 pour mener à bien un projet visant deux objectifs :</p>
<ol>
<li>développer une nouvelle version de Sparnatural (<a href="http://sparnatural.eu/" target="_blank"><span style="color: #1155cc;"><u>http://sparnatural.eu/</u></span></a>), un éditeur open source de requêtes SPARQL (qui est le langage utilisé pour faire des recherches dans des graphes RDF) ;</li>
<li>mettre en place deux démonstrateurs web pleinement opérationnels, pour permettre l’exploration et la recherche intuitives dans des graphes de métadonnées culturelles grâce à des interfaces construites à l’aide de cet outil.</li>
</ol>
<p align="JUSTIFY">La BnF a donc construit avec Sparna un démonstrateur web pour interroger l’ensemble de ses données RDF, soit tout le contenu de <a id="m_-4922382747067794386LPlnk352719" href="https://data.bnf.fr/" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://data.bnf.fr/&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw0tEZBMs7Rohlz68fX70W9T"><span style="color: #1155cc;"><u>data.bnf.fr</u></span></a>. Les Archives nationales (le Lab, en concertation avec le Département du Minutier central des notaires des Paris) ont construit avec Sparna un démonstrateur web qui permet d’interroger les métadonnées décrivant un tiers des archives notariales conservées aux Archives nationales, qu’elles ont préalablement converties en RDF conformément à l’ontologie <a href="https://www.ica.org/standards/RiC/ontology" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.ica.org/standards/RiC/ontology&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw0Kh77VEm-J9IntAJrkp43g">RiC-O</a>.</p>
<p align="JUSTIFY">Une demi-journée le <span style="text-decoration: underline;">17 juin après-midi</span> permettra de présenter en détail les travaux réalisés et les résultats obtenus, puis d’évoquer les perspectives qu’ils ouvrent pour les institutions partenaires et pour d’autres projets.</p>
<p align="JUSTIFY">Elle aura lieu à l’auditorium des Archives nationales sur le site de Pierrefitte-sur-Seine (voir <a id="m_-4922382747067794386LPlnk164387" href="https://www.archives-nationales.culture.gouv.fr/fr/web/guest/site-de-pierrefitte-sur-seine" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.archives-nationales.culture.gouv.fr/fr/web/guest/site-de-pierrefitte-sur-seine&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw3oWAToZcDBgVPC0GLhwfBA"> <span style="color: #1155cc;"><u>https://www.archives-<wbr />nationales.culture.gouv.fr/fr/<wbr />web/guest/site-de-pierrefitte-<wbr />sur-seine</u></span></a>), et sera également accessible à distance via une plateforme de visioconférence.</p>
<p>Le programme de la demi-journée de présentation du projet Sparnatural est désormais téléchargeable depuis l’agenda des Archives nationales (<a id="m_-4922382747067794386LPlnk892914" href="https://www.archives-nationales.culture.gouv.fr/fr/web/guest/235?sia-agenda-parameter=0010111111111" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?q=https://www.archives-nationales.culture.gouv.fr/fr/web/guest/235?sia-agenda-parameter%3D0010111111111&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw1wiXiSZo2Hr7asI-KTbD4K">https://www.archives-<wbr />nationales.culture.gouv.fr/fr/<wbr />web/guest/235?sia-agenda-<wbr />parameter=0010111111111</a>) ou directement à <a id="m_-4922382747067794386LPlnk899055" href="https://www.archives-nationales.culture.gouv.fr/documents/10157/277814/Programme+Sparnatural+2022/" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?q=https://www.archives-nationales.culture.gouv.fr/documents/10157/277814/Programme%2BSparnatural%2B2022/&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw2xJZDynJ23v4DlPCMJpJzj"> https://www.archives-<wbr />nationales.culture.gouv.fr/<wbr />documents/10157/277814/<wbr />Programme+Sparnatural+2022/</a>.</p>
<p>La demi-journée est accessible à tous gratuitement, sur inscription. Pour vous inscrire vous pouvez, soit utiliser le formulaire disponible à <a id="m_-4922382747067794386LPlnk484327" href="https://framaforms.org/inscription-a-la-demi-journee-de-restitution-du-projet-sparnatural-17-juin-2022-1652342598" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?q=https://framaforms.org/inscription-a-la-demi-journee-de-restitution-du-projet-sparnatural-17-juin-2022-1652342598&amp;source=gmail&amp;ust=1653462619942000&amp;usg=AOvVaw23iqTXRo0GZVdRnMsERHwA">https://framaforms.org/<wbr />inscription-a-la-demi-journee-<wbr />de-restitution-du-projet-<wbr />sparnatural-17-juin-2022-<wbr />1652342598</a>), soit écrire à l’adresse  <a href="mailto:le-lab.archives-nationales@culture.gouv.fr" target="_blank">le-lab.archives-nationales@<wbr />culture.gouv.fr</a> en précisant si vous viendrez sur place ou si vous participerez à distance.</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/05/24/evenement-sparnatural-demonstrateurs-archives-nationales-bnf/">Evènement : Sparnatural et les démonstrateurs Archives Nationales + BNF</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/05/24/evenement-sparnatural-demonstrateurs-archives-nationales-bnf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Supports de formation SPARQL CC-BY-SA</title>
		<link>https://blog.sparna.fr/2022/04/19/supports-de-formation-sparql-cc-by-sa/</link>
		<comments>https://blog.sparna.fr/2022/04/19/supports-de-formation-sparql-cc-by-sa/#comments</comments>
		<pubDate>Tue, 19 Apr 2022 20:55:13 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1452</guid>
		<description><![CDATA[<p>&#160;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/04/19/supports-de-formation-sparql-cc-by-sa/">Supports de formation SPARQL CC-BY-SA</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<iframe src='https://www.slideshare.net/slideshow/embed_code/251619316' width='650' height='533' allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/04/19/supports-de-formation-sparql-cc-by-sa/">Supports de formation SPARQL CC-BY-SA</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/04/19/supports-de-formation-sparql-cc-by-sa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vidéo Sparnatural : prototypes BNF et AN</title>
		<link>https://blog.sparna.fr/2022/03/04/video-sparnatural-prototypes-bnf-et-an/</link>
		<comments>https://blog.sparna.fr/2022/03/04/video-sparnatural-prototypes-bnf-et-an/#comments</comments>
		<pubDate>Fri, 04 Mar 2022 18:02:44 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[Non classé]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1446</guid>
		<description><![CDATA[<p>A l&#8217;occasion de l&#8217;évènement Europeana &#171;&#160;Building the common European data space for cultural heritage together&#160;&#187; le 1er mars 2022, j&#8217;ai eu l&#8217;occasion de montrer cette vidéo de présentation du projet Sparnatural en cours avec les Archives Nationales et la Bibliothèque Nationale : Les démonstrateurs qui sont présentés dans cette ne sont pas finalisés (en date&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/03/04/video-sparnatural-prototypes-bnf-et-an/">Vidéo Sparnatural : prototypes BNF et AN</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>A l&rsquo;occasion de l&rsquo;évènement Europeana &laquo;&nbsp;<a href="https://pro.europeana.eu/event/building-the-common-european-data-space-for-cultural-heritage-together">Building the common European data space for cultural heritage together</a>&nbsp;&raquo; le 1er mars 2022, j&rsquo;ai eu l&rsquo;occasion de montrer cette <a href="https://youtu.be/93XV-SZD6tk">vidéo de présentation du projet Sparnatural en cours avec les Archives Nationales et la Bibliothèque Nationale</a> :</p>
<p><iframe title="YouTube video player" src="https://www.youtube.com/embed/93XV-SZD6tk" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>
<p>Les démonstrateurs qui sont présentés dans cette ne sont pas finalisés (en date du 01/03/2022). D&rsquo;autres publications, évènements et communication devraient suivre à la fin de ce projet, à partir mai 2022.</p>
<p>&nbsp;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2022/03/04/video-sparnatural-prototypes-bnf-et-an/">Vidéo Sparnatural : prototypes BNF et AN</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2022/03/04/video-sparnatural-prototypes-bnf-et-an/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fair Data Collective is doing cool things with SKOS Play and xls2rdf</title>
		<link>https://blog.sparna.fr/2021/06/30/fair-data-collective-is-doing-cool-things-with-skos-play-and-xls2rdf/</link>
		<comments>https://blog.sparna.fr/2021/06/30/fair-data-collective-is-doing-cool-things-with-skos-play-and-xls2rdf/#comments</comments>
		<pubDate>Wed, 30 Jun 2021 08:34:52 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[FAIR]]></category>
		<category><![CDATA[SKOS]]></category>
		<category><![CDATA[SKOS Play]]></category>
		<category><![CDATA[dataviz]]></category>
		<category><![CDATA[skos play]]></category>
		<category><![CDATA[xls2rdf]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1440</guid>
		<description><![CDATA[<p>The FAIR Data Collective is doing cool things to enable researchers to easily publish their vocabularies as SKOS linked data while easily editing the vocabulary content in Excel spreadsheets, converted using the xls2rdf library in SKOS Play from Sparna. They turned the converter in a Github actions pipeline, so that you push your Excel spreadsheet&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2021/06/30/fair-data-collective-is-doing-cool-things-with-skos-play-and-xls2rdf/">Fair Data Collective is doing cool things with SKOS Play and xls2rdf</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>The <strong><a href="https://github.com/fair-data-collective">FAIR Data Collective</a></strong> is doing cool things to enable researchers to <a href="https://excel2rdf.readthedocs.io/en/latest/">easily publish their vocabularies as SKOS linked data</a> while easily editing the vocabulary content in Excel spreadsheets, converted using the <a href="https://github.com/sparna-git/xls2rdf">xls2rdf library</a> in <a href="https://skos-play.sparna.fr/play/">SKOS Play</a> from Sparna. They turned the converter in a Github actions pipeline, so that you push your Excel spreadsheet based on a <a href="https://github.com/fair-data-collective/excel2rdf-template/blob/main/vocabulary.xlsx">provided Excel template</a> to your Github repo, and <em>abracadabra !</em> you get a SKOS RDF file that can be loaded in a Fuseki instance and visible in Skosmos, and even submitted to BioPortal or OntoPortal.</p>
<p>Here is also <a href="https://www.youtube.com/watch?v=NkgC3yXKgVU"><strong>nice video</strong> showing how to visualize such a SKOS vocabulary in SKOS Play visualization tools</a>.</p>
<p>Thanks to <a href="https://www.linkedin.com/in/niva83">Nikola Vasiljevic</a> and <a href="https://www.linkedin.com/in/johngraybeal">John Graybeal</a> from FAIR Data Collective for this nice integration !</p>
<p>You can check out the <a href="https://www.linkedin.com/company/fair-data-collective/">Fair Data Collective page on LinkedIn</a> : <em>&laquo;&nbsp;Making practical and easy-to-use FAIR data solutions&nbsp;&raquo;</em>.</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2021/06/30/fair-data-collective-is-doing-cool-things-with-skos-play-and-xls2rdf/">Fair Data Collective is doing cool things with SKOS Play and xls2rdf</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2021/06/30/fair-data-collective-is-doing-cool-things-with-skos-play-and-xls2rdf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Alimenter Talend avec SPARQL (sur Wikidata)</title>
		<link>https://blog.sparna.fr/2021/03/24/alimenter-talend-avec-sparql-sur-wikidata/</link>
		<comments>https://blog.sparna.fr/2021/03/24/alimenter-talend-avec-sparql-sur-wikidata/#comments</comments>
		<pubDate>Wed, 24 Mar 2021 09:40:55 +0000</pubDate>
		<dc:creator><![CDATA[Thomas Francart]]></dc:creator>
				<category><![CDATA[RDF]]></category>
		<category><![CDATA[Talend]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[SPARQL]]></category>
		<category><![CDATA[talend]]></category>
		<category><![CDATA[wikidata]]></category>

		<guid isPermaLink="false">http://blog.sparna.fr/?p=1409</guid>
		<description><![CDATA[<p>Dans le billet précédent nous avons vu comment Talend pouvait être utilisé pour convertir des données existantes vers du RDF/XML pour alimenter un graphe de connaissances. Ici nous allons voir… exactement l’inverse ! Comment alimenter Talend avec une requête SPARQL ? En d&#8217;autres termes comment votre graphe de connaissances RDF pourra servir d’entrée à un&#8230;</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2021/03/24/alimenter-talend-avec-sparql-sur-wikidata/">Alimenter Talend avec SPARQL (sur Wikidata)</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Dans le billet précédent nous avons vu <a href="http://blog.sparna.fr/2021/03/17/rdf-talend-tutorial/">comment Talend pouvait être utilisé pour convertir des données existantes vers du RDF/XML</a> pour alimenter un graphe de connaissances. Ici nous allons voir… exactement l’inverse ! <strong>Comment alimenter Talend avec une requête SPARQL</strong> ? En d&rsquo;autres termes <em>comment votre graphe de connaissances RDF pourra servir d’entrée à un traitement de conversion de données pour exporter des données tabulaires, alimenter d’autres bases, ou se combiner avec d’autres flux.</em></p>
<p>Le principe est simple : arriver à <strong>exécuter une requête SPARQL puis traiter les résultats correspondants pour en faire un tableau de données</strong>. Ce tableau de données pourra ensuite être exporté, combiné, enregistré, comme vous le souhaitez.</p>
<p>Pour illustrer cela nous allons interroger <a href="http://wikidata.org"><strong>Wikidata</strong></a> au travers de son <a href="https://query.wikidata.org">service d’interrogation SPARQL</a> en utilisant sa première requête d’exemple qui récupère… les chats !</p>
<p>La requête est la suivante, et voici le <a href="https://query.wikidata.org/#%23Chats%0ASELECT%20%3Fitem%20%3FitemLabel%20%0AWHERE%20%0A%7B%0A%20%20%3Fitem%20wdt%3AP31%20wd%3AQ146.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D">lien direct pour l’exécuter dans Wikidata</a> :</p>
<pre><span style="font-size: 10pt;">SELECT ?item ?itemLabel</span>
<span style="font-size: 10pt;">WHERE {</span>
<span style="font-size: 10pt;">  ?item wdt:P31 wd:Q146.</span>
<span style="font-size: 10pt;">  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }</span>
<span style="font-size: 10pt;">}</span>
<span style="font-size: 10pt;">LIMIT 10</span></pre>
<p>Vous pouvez télécharger le job présenté ici dans <a href="https://github.com/sparna-git/talend-rdf-components/tree/main/SPARQL_CSV_test/BUILDERRDF">ce repository Github d’exemple</a>, et l’importer directement dans Talend.</p>
<p>Nous allons utiliser les composants Talend suivant :</p>
<ul>
<li><a href="https://help.talend.com/r/4~rC6oITH8avsLVct2LPSA/9XSS~cm5dHaZcH2mrWSR1w"><strong>tRESTClient</strong></a> envoie des requêtes HTTP à un service REST et retourne les réponses; en effet, un service SPARQL n’est ni plus ni moins qu’une URL où on passe un paramètre “query”, comme spécifié par le <a href="https://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/">protocole SPARQL</a>.</li>
<li><a href="https://help.talend.com/r/AsV4_TX51DXfRElBkPQ4Qw/Pc9RZi6IiWw1Kb~Jf0bE0Q"><strong>tExtractXMLField</strong></a> pour traiter le format XML de réponse SPARQL; en effet, le <a href="https://www.w3.org/TR/2013/REC-rdf-sparql-XMLres-20130321/">format de réponse d’un service SPARQL</a> est lui-aussi standardisé, en XML ou en JSON;</li>
<li><a href="https://help.talend.com/r/atTvdntoupqchAynyb03~Q/cGhZ8PINK8GErF~qZbpprA"><strong>tFileOutputDelimited</strong></a> pour simplement écrire le résultat dans un fichier de sortie.</li>
</ul>
<p style="text-align: left;"><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/1_Flow.png"><img class="size-full wp-image-1410 aligncenter" src="http://blog.sparna.fr/wp-content/uploads/2021/03/1_Flow.png" alt="1_Flow" width="605" height="76" /></a></p>
<h2>Création d’un Job</h2>
<p>Pour commencer, vous devez créer un nouveau job.</p>
<ul>
<li>Faite un clic droit sur <strong>Jobs</strong> dans le panneau de gauche<strong>. </strong>choisissez l’option <strong>Créer un Job</strong>.</li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/2_CréerJob.png"><img class="aligncenter size-medium wp-image-1411" src="http://blog.sparna.fr/wp-content/uploads/2021/03/2_CréerJob-300x195.png" alt="2_CréerJob" width="300" height="195" /></a></p>
<ul>
<li> Remplissez les champs nécessaires de la fenêtre <strong>Nouveau Job</strong> et cliquez sur le bouton finish.</li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/3_ParametrerJob.png"><img class="aligncenter size-medium wp-image-1412" src="http://blog.sparna.fr/wp-content/uploads/2021/03/3_ParametrerJob-300x184.png" alt="3_ParametrerJob" width="300" height="184" /></a></p>
<h2> Appel SPARQL avec tRESTClient</h2>
<ul>
<li>Ajoutez au job le composant <strong>tRESTClient</strong>.</li>
<li>Cliquez deux fois sur le composant <strong>tRESTClient</strong>, allez à la propriété <strong>Paramètres simple</strong> et remplissez les paramètres suivants:</li>
</ul>
<ol>
<ol>
<li><strong>URL</strong>: L’URL du service SPARQL de Wikidata est <strong><a href="https://query.wikidata.org/sparql">https://query.wikidata.org/sparql</a></strong> .</li>
<li><strong>Méthode HTTP</strong>: Choisissez la méthode HTTP <strong>GET</strong></li>
<li><strong>Paramètre de la Requête</strong>: Nous devons ajouter le paramètre “query”, cliquez sur le bouton plus [+], et dans la colonne Nom entrez “query”. Dans la <strong>colonne Valeur</strong> vous allez saisir la requête SPARQL.</li>
</ol>
</ol>
<p><span style="color: #ff0000;"><strong>Attention!</strong></span>  La requête SPARQL est une chaîne de caractères Java, vous devez donc : 1/ L&rsquo;entourer avec des guillemets doubles 2/ ajouter le caractère d’échappement <strong>\</strong> avant les guillemets dans la requête et 3/ écrire la requête sur une seule ligne. Voici la chaîne de caractères correspondante :</p>
<pre><span style="font-size: 10pt;"><span style="font-weight: 400;">“SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146. SERVICE wikibase:label { bd:serviceParam wikibase:language </span><b>\</b><span style="font-weight: 400;">"[AUTO_LANGUAGE],en</span><b>\</b><span style="font-weight: 400;">". } } LIMIT 10”</span></span></pre>
<p>&nbsp;</p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/4_ParametrerComponentSource.png"><img class="aligncenter size-large wp-image-1413" src="http://blog.sparna.fr/wp-content/uploads/2021/03/4_ParametrerComponentSource-1024x430.png" alt="4_ParametrerComponentSource" width="650" height="273" /></a><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/4_ParametrerComponentSource.png"><br />
</a></p>
<h2>Transformation des résultats SPARQL avec tExtractXMLField</h2>
<ul>
<li>Ajoutez dans le projet un composant <strong>tExtractXMLField</strong>.</li>
<li>Connectez le composant tRESTClient au tExtractXMLField.</li>
</ul>
<p>Nous allons paramétrer le tExtractXMLField :</p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/5_tExtractXMLField_Colonne.png"><img class="aligncenter size-large wp-image-1414" src="http://blog.sparna.fr/wp-content/uploads/2021/03/5_tExtractXMLField_Colonne-1024x408.png" alt="5_tExtractXMLField_Colonne" width="650" height="259" /></a></p>
<ol>
<li style="font-weight: 400;"><span style="font-weight: 400;">Cliquez sur le bouton <strong>Modifier le schéma</strong> pour ouvrir la fenêtre des colonnes d&rsquo;entrée et sortie du composant <strong>tExtractXMLField</strong>. </span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Ajoutez deux nouvelles colonnes <strong>Uri </strong>et <strong>Label </strong>de <strong>type String</strong> avec le bouton <strong>plus [+] </strong>et cliquez sur le bouton Ok. <a href="http://blog.sparna.fr/wp-content/uploads/2021/03/6_tExtractXMLField_Colonne_sortie.png"><img class="aligncenter size-large wp-image-1415" src="http://blog.sparna.fr/wp-content/uploads/2021/03/6_tExtractXMLField_Colonne_sortie-1024x408.png" alt="6_tExtractXMLField_Colonne_sortie" width="650" height="259" /></a></span></li>
<li style="font-weight: 400;">Allez à <strong>Paramètres simple</strong> et modifiez les options suivantes:</li>
</ol>
<ul>
<li><strong>Champ XML</strong>: Choisissez le champs “<strong>body”</strong>, qui est le champ qui contient la réponse à l’appel SPARQL du composant précédent;</li>
<li><strong>Requête XPath boucle</strong>: Saisissez &laquo;&nbsp;/sparql/results/result&nbsp;&raquo; qui est d’après la spec du format de résultat SPARQL le chemin vers chaque <strong>ligne de résultats</strong> dans la réponse.</li>
<li>La table <strong>Mapping</strong> : <em>c’est ici que tout se joue !!! ce mapping va vous permettre d’associer les colonnes de votre résultat SPARQL au champs de sortie du composant, par le biais de chemins XPath</em>:
<ol>
<li>Pour la colonne <strong>Uri</strong> la valeur de la colonne Requête Xpath sera <strong>&laquo;&nbsp;binding[@name=&rsquo;item&rsquo;]/uri&nbsp;&raquo;</strong></li>
<li>pour la colonne <strong>Label</strong> la valeur de la colonne Requête Xpath sera <strong>&laquo;&nbsp;binding[@name=&rsquo;itemLabel&rsquo;]/literal&nbsp;&raquo;</strong>.</li>
<li>Si la requête SPARQL retournait plus de colonnes, il faudrait ajouter ici les mappings correspondants pour alimenter les autres colonnes du résultat.</li>
</ol>
</li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/7_tExtractXMLField_Component.png"><img class="aligncenter size-large wp-image-1416" src="http://blog.sparna.fr/wp-content/uploads/2021/03/7_tExtractXMLField_Component-1024x297.png" alt="7_tExtractXMLField_Component" width="650" height="189" /></a></p>
<h2> Génération du fichier de sortie</h2>
<ul>
<li>Ajoutez le composant de sortie <strong>tFileOutputDelimited</strong>.</li>
<li>Connectez le composant <strong>tExtractXMLField </strong>au composant <strong>tFileOutputDelimited</strong>.</li>
<li>Paramétrez le composant dans la section de <strong>Paramètres simple</strong> → <strong>Nom de fichier</strong>: le chemin dans lequel vous souhaitez sauvegarder le fichier de sortie.</li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/8_tFileOutputDelimited.png"><img class="aligncenter size-large wp-image-1417" src="http://blog.sparna.fr/wp-content/uploads/2021/03/8_tFileOutputDelimited-1024x175.png" alt="8_tFileOutputDelimited" width="650" height="111" /></a></p>
<h2> Lancer le Job</h2>
<ul>
<li>Allez à la section <strong>Exécuter</strong>.</li>
<li>Cliquez sur le bouton <strong>Exécuter.</strong></li>
</ul>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/9_LancerJob.png"><img class="aligncenter size-large wp-image-1418" src="http://blog.sparna.fr/wp-content/uploads/2021/03/9_LancerJob-1024x222.png" alt="9_LancerJob" width="650" height="141" /></a></p>
<h2> Profitez !</h2>
<p>Naviguez vers l’emplacement du fichier pour le récupérer.</p>
<p><a href="http://blog.sparna.fr/wp-content/uploads/2021/03/10_RouteFile.png"><img class="aligncenter size-large wp-image-1419" src="http://blog.sparna.fr/wp-content/uploads/2021/03/10_RouteFile-1024x439.png" alt="10_RouteFile" width="650" height="279" /></a></p>
<p><strong>Et voilà le résultat :</strong></p>
<p>&nbsp;</p>
<pre><span style="font-size: 10pt;">Uri;Label</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q378619;CC</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q498787;Muezza</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q677525;Orangey</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q851190;Mrs. Chippy</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1050083;Catmando</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1201902;Tama</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1207136;Dewey Readmore Books</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1371145;Socks</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1386318;F. D. C. Willard</span>
<span style="font-size: 10pt;"> http://www.wikidata.org/entity/Q1413628;Nora</span></pre>
<p>Vous savez donc maintenant <strong>comment alimenter Talend à partir d’une base accessible en SPARQL, en quelques clics et sans code</strong> ! Cela permet de valoriser votre graphe de connaissances pour l’intégrer dans le reste du système d’information.</p>
<p>Cet article <a rel="nofollow" href="https://blog.sparna.fr/2021/03/24/alimenter-talend-avec-sparql-sur-wikidata/">Alimenter Talend avec SPARQL (sur Wikidata)</a> est apparu en premier sur <a rel="nofollow" href="https://blog.sparna.fr">Sparna Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sparna.fr/2021/03/24/alimenter-talend-avec-sparql-sur-wikidata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
