Published on :

SPARQL update test on local server

This code is also available in: Deutsch Español Français
Awaiting validation
This program uses the `%sparqlupdate` macro (from the included 'sparqlquery.sas©' file) to send a SPARQL `INSERT DATA` command to a local service (http://localhost:3030). It inserts RDF metadata (triples) concerning a clinical trial. The result of the HTTP operation is stored in a temporary SAS© table and then displayed.
Data Analysis

Type : EXTERNE


The script interacts with an external web service (SPARQL endpoint) to send data. The result table 'updateresult' is generated by the macro based on the service's response.

1 Code Block
OPTIONS
Explanation :
Configuration of environment options (macro display) and inclusion of the 'sparqlquery.sas' macro library required for execution.
Copied!
1options mprint nocenter;
2%include "sparqlquery.sas";
3 
2 Code Block
MACRO Data
Explanation :
Call to the `%sparqlupdate` macro to execute a SPARQL `INSERT DATA` query. The parameters define the endpoint URL, the SPARQL query itself (with RDF prefixes and data to insert), the output table name (`updateresult`), and activate debug mode.
Copied!
1%sparqlupdate(
2endpoint=http://localhost:3030/test/update,
3update=%str(
4prefix ct:
5prefix css:
6prefix owl: 2002/07/owl#>
7prefix rdf: 1999/02/22-rdf-syntax-ns#>
8prefix xsd: 2001/XMLSchema#>
9prefix rdfs: 2000/01/rdf-schema#>
10 
11INSERT DATA
12{
13ct:NCT00799760 css:enrollment "541"^^xsd:int ;
14 css:phase "Phase 3" ;
15 css:title "Evaluation of Efficacity and Safety of Oseltamivir and Zanamivir" .
16}
17),
18resultdsn=updateresult,
19debug=Y
20);
3 Code Block
PROC PRINT
Explanation :
Display of the `updateresult` table content to check the update status (success or error returned by the SPARQL server).
Copied!
1PROC PRINT DATA=updateresult width=min;
2RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.