1 - SDaaS Ontology

the terms in the SDaaS language profile

SDaaS Enterprise edition is fully compliant with the language profile in the latest KEES implementation proposal.

SDaaS Enterprise Edition extends the support to the KEES Language profile by managing additional metadata on named graph:

-prov:startedAtTime and prov:endedAtTime properties are recognized in prov:Activity metadata. Activities with a start date but without an end date should considered not yet terminated or crashed. prov:endedAtTime coincides with the value of one of dct:modified attributes in graph metadata. Activities without bot star and end data should be considered as planned activities still do be done.

  • the prov:wasAttributedTo property refers to the SDaaS agent URI (i.e. $AGENT_ID)
  • the prov:used property is recognized in prov:Activity metadata. It refers the URI of a generic LDP-RS resource providing facts input to the activity, or a void:Dataset, or a sdaas:Plan and coincides with the value of one of dct:source attributes in the graph metadata
  • the URI of the named graph is generated by the graph store driver in order to be uniquely associated to its name and dereferentiable.

For example:

    <http://kb:8080/sdaas/sparql?query=DESCRIBE%3Fg%7B%3Fg%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Fsparql-service-description%23name%3E%3Curn%3Auuid%3A98dccee27a081f9cd75d15b8af59a3d6%3E%7D> a sd:NamedGraph;
        sd:name <urn:uuid:98dccee27a081f9cd75d15b8af59a3d6> ;
        dct:modified "2023-12-10T01:01:02Z"^^xsd:dateTime ;
        dct:source  <http:/example.org/resource.ttl> ;
        prov:wasAttributedTo <urn:uuid:0dead0cf-943b-46c0-98e9-db0da3172f5e> ;
        dqv:hasQualityMeasurement [  dqv:value 0.8 ; dqv:isMeasurementOf kees:trustLevel ] ;
        prov:wasGeneratedBy [ a kees:Ingestion ;
            prov:startedAtTime "2023-12-10T00:00:02Z"^^xsd:dateTime ;
            prov:endedAtTime "2023-12-10T01:00:02Z"^^xsd:dateTime ;
            prov:used <http:/example.org/resource.ttl>
        ]
    .

Multiple activities can concur to the generation of a named graph, for example:

    <http://kb:8080/sdaas/sparql?query=DESCRIBE%3Fg%7B%3Fg%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Fsparql-service-description%23name%3E%3Curn%3Auuid%3A98dccee27a081f9cd75d15b8af59a3d6%3E%7D> a sd:NamedGraph;
        sd:name <urn:uuid:98dccee27a081f9cd75d15b8af59a3d6> ;
        dct:modified "2023-12-10T01:01:02Z"^^xsd:dateTime ;
        dct:modified "2023-12-10T01:02:02Z"^^xsd:dateTime ;
        dct:source  
            <http:/example.org/resource1.ttl> ,
            <http:/example.org/resource2.ttl> ;
        prov:wasAttributedTo <urn:uuid:0dead0cf-943b-46c0-98e9-db0da3172f5e> ;
        dqv:hasQualityMeasurement 
            [  dqv:value 0.7 ; dqv:isMeasurementOf kees:trustLevel ] ,
            [  dqv:value 0.8 ; dqv:isMeasurementOf kees:trustLevel ] ;
        prov:wasGeneratedBy 
            [ a kees:Ingestion ;
                prov:startedAtTime "2023-12-10T00:00:02Z"^^xsd:dateTime ;
                prov:endedAtTime "2023-12-10T01:00:02Z"^^xsd:dateTime ;
                prov:used <http:/example.org/resource1.ttl>
            ] ,
            [ a kees:Ingestion ;
                prov:startedAtTime "2023-12-10T0100:02Z"^^xsd:dateTime ;
                prov:endedAtTime "2023-12-10T02:00:02Z"^^xsd:dateTime ;
                prov:used <http:/example.org/resource2.ttl>
            ] 
    .

Note that multiple quality measurements MAY exist to reflect the possible quality differences in data sources or different points ov view.

In the real implementation SDaaS does not use blank nodes but unique ids generated with the sd uuid core command

SDaaS Vocabulary

The SDaaS Language Profile reuses some terms from existing vocabularies:

PrefixURL
dcthttp://purl.org/dc/terms/
dqvhttp://www.w3.org/ns/dqv#
provhttp://www.w3.org/ns/prov#
sdhttp://www.w3.org/ns/sparql-service-description#
voidhttp://rdfs.org/ns/void#
xsdhttp://www.w3.org/2001/XMLSchema#
keeshttp://linkeddata.center/kees/v1#

Besides to all terms defined in the KEES Language profile, the SDaaS Language profile uses some special term minted from the http://linkeddata.center/sdaas/reference/v4# name space ( prefix sdaas:)

Classes

Plan

Description :a class that references a some commands command

Subclass of
prov:Plan

Data properties

script

Description
the annotated sdaas:Plan is composed by bash script using SDaaS commands
Domain
sdaas:Plan
Range
xsd:String

Example:

[] a sdaas:Plan ; sdaas:script “echo ‘ASK {}’ | sd sparql test”

2 - ⚗️ sd_learn_datalake

Synopsis

sd_learn_datalake -D [METADATA] [-D “graph=GRAPHNAME”] DATA_ROOT

Description

Discovers and loads datasets description file according with VoID specifications and then learn all found datasets. This command is essentially the same as the combination of the following pseudo code:

if sd learn resource -a PUT *SOURCE*/well-known/void; then
	for dataset in $(echo "SELECT DISTINCT ?dataset {  GRAPH <*SOURCE> {?dataset <http://rdfs.org/ns/void#dataDump> [] }}" | sd_sparql_list); do
		sd learn dataset "$dataset"
	done
fi
DATA_ROOT
the uri of a VOid home page. source must be an http home page ending with a /
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)
METADATA
following metadata are supported:
Variable NameDefaultDescription
sidSTOREA sid name
trust1Trust level as a xds:decimal ranging 0..1
activityActivitya KEES activity type (without namespace) OR xsd:anyURI
graphsame of sourceXSD:anyURI Named graph name
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date

Exit status

Exits with 0 on success, and > 0 if a curl or http error occurs.

Availability

Since SDaaS 4

Example

sd learn data http://data.example.org/

3 - ⚗️sd_learn_dataset

loads all data dumps in a VOiD dataset

Synopsis

sd_learn_dataset [-s SID] [-D METADATA] DATASET

Description

Loads all dataset dumps file according with VoID specifications.This command is essentially the same as the combination of the following pseudo code:

for dd in $(echo "SELECT DISTINCT ?dd { <$graph}> void:dataDump ?dd }" | sd sparql list); do
    sd learn resource 
done
DATASET
the URI of a VOid Dataset to be load. Only datasets exposing data dumps are considered.
-s SID
connect to Graph Store named SID ( STORE by default)
-D METADATA
the following local variables are supported:
Variable NameDefaultDescription
sidSTOREsame as -s
trust1Trust level as a xds:decimal ranging 0..1
activityActivitya KEES activity type (without namespace) OR xsd:anyURI
graphsame of sourceXSD:anyURI Named graph name
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date
accrual_policyPOSTgraph accrual policy: POST or PUT

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

Example

sd learn resource -D “graph=https://dbpedia.org/” https://dbpedia.org/resource/Milan

4 - ⚗️sd_plan_loop

execute a sdaas plan in loop till no changes in graph stores

Equivalent to:

previous_size=-1; actual_size=$(sd driver size STORE)
while [[ $previous_size -ne $actual_size ]]; do
    previous_size=$actual_size
    sd plan run -D "activity_type=Abduction trust=0.9" urn:myapp:reasoning_plan
    actual_size=$(sd driver size STORE)
done

Synopsis

sd_plan_loop [-s SID] [-D METADATA] PLAN_URI

Description

This command executed execute a plan until nothing changes. It is equivalent to the following pseudocode:

previous_size=-1; actual_size=$(sd driver size *SID*)
while [[ $previous_size -ne $actual_size ]]; do
    previous_size=$actual_size
    sd plan loop run  *PLAN_URI*
    actual_size=$(sd driver size *SID*)
done
PLAN_URI
the uri of a sdaas:Plan subject
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

Example

sd plan run urn:my:plan

5 - ⚗️sd_plan_run

execute a sdaas

Synopsis

sd_plan_run [-s SID] [-D METADATA] PLAN_URI

Description

This command executed a script exposed by PLAN_URI in the sdaas:script property

PLAN_URI
the uri of a sdaas:Plan subject
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

Example

sd plan run urn:my:plan

6 - sd

call a SDaaS command

Synopsis

sd [-h] [-A] MODULE FUNCTION [FUNCTION ARGS]

Description

Execute a SDaaS platform FUNCTION by automatically including MODULE and running the command sd_<MODULE>_<FUNCTION> followed by FUNCTION ARGS

-A
abort if the command returns is > 0 .

Note that negative values does not trigger an exit because negative return status are considered by SDaaS platform as boolean false result.

-h
prints an help description about the command

Exit status

If not -A specified return the command status

Availability

Since SDaaS 4

Examples

sd sparql query "SELECT * { ?s ?p ?o } LIMIT 1"
Prints an RDF triple in the STORE instance.
sd -A sparql query "SELECT * { ?s ?p ?o } LIMIT 1"
Similar to the previous command, aborts on any sparql query failure.
sd -h sparql query
prints the manual of sd_sparql_query command

7 - sd_abort

log a critical error and exit SDaaS

Synopsis

sd_abort [MESSAGE]

Description

logs a MESSAGE for critical error and exit from the caller

Exit status

Exits 0 on success, and 2 if an error occurs.

Availability

Since SDaaS 4

Example

sd_abort "command failed"
abort the program logging the error message “command failed”
<command> || sd_abort "command failed"
abort the program if returns not 0

8 - sd_cat

a wrapper for cat

Synopsis

sd_cat cat arguments

Description

its an alias for: cat "$@" 2> /dev/null

Exit status

Exits with 0 on success

Availability

Since SDaaS 4

9 - sd_curl

a wrapper for curl

Synopsis

sd_curl CURL ARGUMENTS

Description

its an alias for: curl -L -A "$SDAAS_SIGNATURE" --retry 3 --retry-delay 3 --retry-max-time 30 --retry-connrefused --compressed

Exit status

Exits with 0 on success, and not 0 if a curl or http error occurs.

Availability

Since SDaaS 4

10 - sd_curl_rdf

a wrapper for curl with content management for RDF

Synopsis

sd_curl_rdf ARGUMENTS

Description

It is an alias for sd_curl -s -f -H "Accept: application/rdf+xml, text/turtle;q=0.9, application/n-triples;q=0.8, */*;q=0.5"

Exit status

Exits with 0 on success, and not 0 if a curl or http error occurs.

Availability

Since SDaaS 4

11 - sd_curl_sparql

a wrapper for curl with content management for SPARQL command files

Synopsis

sd_curl_sparql ARGUMENTS

Description

It is an alias for sd_curl -s -f -H "Accept: application/sparql-query, application/sparql-update;q=0.9, */*;q=0.5" "$@"

Exit status

Exits with 0 on success, and not 0 if a curl or http error occurs.

Availability

Since SDaaS 4

12 - sd_error

return an error code and log a message

Synopsis

sd_error MESSAGE [ERROR_CODE]

Description

logs a MESSAGE with ERROR priority

Exit status

ERROR_CODE (1 by default)

Availability

Since SDaaS 4

Example

<command> || return sd_error "command failed" 3
return 3 if the program if returns not 0

13 - sd_include

include a module

Synopsis

sd_include [-f] MODULE

Description

include MODULE only if it is not already loaded, used by sd command.

This command tries to load MODULE form $HOME/modules/ directory and, if file not exist, tries to load it from $SDAAS_INSTALL_DIR .

-f
force the module cache to stale and re- load the module

Exit status

Exits 0 on success, and >0 if an error occurs.

Availability

Since SDaaS 4

Examples

sd_include core || sd_abort
includes all commands exposed by the module core just the first time. Abort scripts on fail
sd_include -f core
reload all commands exposed by the module core ignoring its cache status

14 - sd_kees_boot

Synopsis

sd_kees_boot [-D “sid=SID ] [-s SID]

Description

The command erases all data in a graph store using a driver-optimized routine. Additionally, this command adds metadata to the default graph according with the KEES specifications, as shown in this snippet:

[] a kees:KnowledgeGraph ;
    sd:endpoint <$STORE> ;
    sd:feature kees:Status, kees:Locking ;
    dct:created "2023-12-10T01:00:01Z"^^xsd:dateTime .

sd_kees_boot preserves locks (if any)

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

sd_kees_boot
execute the command DROP ALL on the Graph Store named STORE (equivalent to sd_sparql_update"DROP ALL")
sd_kees_boot -s STORE2
same of above but using the Graph Store identified by the sid STORE2

15 - sd_kees_date

Synopsis

sd_kees_date [-D “sid=SID ] [-s SID] STATUS

Description

Prints the date of one STATUS, prints the empty string if the status is not available.

STATUS
is one one of :
  • created
  • ingested
  • reasoned
  • enriched
  • published
  • versioned
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

sd kees date published
returns the last date of the knowledge base publishing (empty string if never published)

16 - sd_kees_describe

Synopsis

sd_kees_describe [-D “sid=SID ] [-s SID]

Description

Describe the knowledge base as a set of nTriples

ACTIVITY_URI An URI of a prov:Activity. In missing a uuid is generated.

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

17 - sd_kees_invalidate

Synopsis

sd_kees_invalidate [-D “sid=SID ] [-s SID] [ACTIVITY_URI]

Description

Invalidate the knowledge graph with the ACTIVITY_URI.

ACTIVITY_URI An URI of a prov:Activity. In missing a uuid is generated.

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

sd kees sd_kees_invalidate
set the knowledge base prov:wasInvalidatedBy to to a uuid of thoe prov:Activity

18 - sd_kees_is

Synopsis

sd_kees_is [-D “sid=SID ] [-s SID] STATUS

Description

Returns 0 if the knowledge graph has is a date associated to STATUS

STATUS
is one one of :
  • ingested : means that the knowledge graph is ingested
  • reasoned : means that the knowledge graph is reasoned
  • enriched : means that the knowledge graph is enriched
  • published : means that the knowledge graph is published
  • versioned : means that the knowledge graph is versioned
  • stable : means that the knowledge graph is published or versioned and not invalid
  • invalid: means that there is a knowleghe graph invalidation request
  • empty: means that the knowledge base is empty
  • locked: means that the knowledge base is locked
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

19 - sd_kees_lock

Synopsis

sd_kees_lock [-D “sid=SID ] [-s SID] [-a AGENT_URI ] [ACTIVITY_URI]

Description

Locks the knowledge graph with the ACTIVITY_URI. The lock is removed on EXIT signal.

If a knowledge graph is locked, you can manually unlock it with the SPARQL update:

PREFIX kees: <http://linkeddata.center/kees/v1#>
DELETE  { ?x kees:isLockedBy ?y }
WHERE  { ?x kees:isLockedBy ?y }

ACTIVITY_URI An URI of a prov:Activity. If missing, the value of the ACTIVITY_URI is used.

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)
-a AGENT_URI
uses AGENT_URI as the activity URI used to mark the lock. By default is AGENT_ID

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

sd kees lock
set the knowledge graph locked

20 - sd_kees_metadata

print kees metadata

Synopsis

sd_kees_matadata [-D METADATA ] GRAPH NAME

Description

print the metadata about a named graph with name GRAPH NAME serialized in in nTriples. This command is mainly intended for internal use only.

GRAPH NAME, -D “graph=GRAPH NAME
an URI for the graph name
METADATA
following metadata are supported:
Variable NameDefaultDescription
trust1Trust level as a xds:decimal ranging 0..1
activity_typeLearninga KEES activity type (without namespace) OR xsd:anyURI
graphuuidXSD:anyURI Named graph name
graph_typeFirstPartyDataa KEES named_graph type (without namespace) OR xsd:anyURI
sourceXSD:anyURI The data source
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and >0 if an error occurs.

Availability

Since SDaaS 4

21 - sd_kees_unlock

Synopsis

sd_kees_unlock [-D “sid=SID ] [-s SID]

Description

Locks the knowledge graph with the ACTIVITY_URI.

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, and > 0 if an error occurs.

Availability

Since SDaaS 4 - Enterprise Edition

Examples

sd kees unlock
unlock the knowledge graph

22 - sd_learn_file

loads an RDF file with its provenance metadata

Synopsis

sd_learn_file [-s SID] [-a PUT|POST] [-D METADATA] FILE

Description

Loads a file into the graph store. This command is essentially the same as the combination of the following piped commands:

sd_rapper | sd kees meta | sd sparql graph 
FILE
the path of a local file (both relative or absolute). COuld be omitted if -D “input_file=FILE” is present.
-s SID
connect to Graph Store named SID ( STORE by default)
-a PUT|POST
the graph accural policy. can be PUT or POST. With PUT data substitute existing graph, with POST data is appended to the graph
-D METADATA
the following local variables are supported:
Variable NameDefaultDescription
sidSTOREsame as -s
trust1Trust level as a xds:decimal ranging 0..1
activity_typeLearninga KEES activity type (without namespace) OR xsd:anyURI
graphsame of sourceXSD:anyURI Named graph name
graph_typeFirstPartyDataa KEES named_graph type (without namespace) OR xsd:anyURI
sourcefile://localhost/<absolute FILE path>XSD:anyURI in file: schema
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date
accrual_policyPOSTsame as -a

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

Example

sd learn file -D “graph=urn:app:config” /etc/config.ttl

23 - sd_learn_resource

loads an RDF resource with its provenance metadata

Synopsis

sd_learn_resource [-s SID] [-a PUT|POST] [-D METADATA] SOURCE

Description

This command is essentially the same as the combination of the following piped commands:

sd_curl_rdf | sd_rapper | sd_kees_metadata -D "source=*SOURCE* | sd sparql graph
SOURCE
the source URL to be load
-s SID
connect to Graph Store named SID ( STORE by default)
-a PUT|POST
the graph accural policy. can be PUT or POST. With PUT data substitute existing graph, with POST data is appended to the graph
-D METADATA
the following local variables are supported:
Variable NameDefaultDescription
sidSTOREsame as -s
trust1Trust level as a xds:decimal ranging 0..1
activityActivitya KEES activity type (without namespace) OR xsd:anyURI
graphSOURCEXSD:anyURI Named graph name
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date
accrual_policyPOSTsame as -a

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

Example

sd learn resource -D “graph=urn:dataset:dbpedia” https://dbpedia.org/resource/Milan

24 - sd_learn_rule

Synopsis

sd_learn_rule [-s SID] [-a PUT|POST] [-D METADATA]

Description

This command is essentially the same as the combination of the following piped commands:

sd sparql rule | sd kees metadata | sd sparql graph 
-s SID
connect to Graph Store named SID ( STORE by default)
-a PUT|POST
the graph accural policy. can be PUT or POST. With PUT data substitute existing graph, with POST data is appended to the graph
-D METADATA
the following local variables are supported:
Variable NameDefaultDescription
sidSTOREsame as -s
trust1Trust level as a xds:decimal ranging 0..1
activityReasoninga KEES activity type (without namespace) OR xsd:anyURI
graphurn:sdaas:aboxXSD:anyURI Named graph name
activity_iduuidXSD:anyURI Identifier for a prov:Activity
started_atactivity start date
accrual_policyPOSTsame as -a

Exit status

Exits with 0 on success, and > 0 if error occurs.

Availability

Since SDaaS 4

25 - sd_log

log a message

Synopsis

sd_log [-f FILE] [-p PRIORITY] [-S SIZE] MESSAGE

Description

log MESSAGE on stderr

-f FILE
Log the contents of the specified FILE. This option cannot be combined with a command-line message.
-p PRIORITY
log the MESSAGE with the specified PRIORITY. The priority may be specified numerically or as a mnemonic string (see table). The default is NOTICE. Logs is printed only if its priority is less then the value in SD_LOG_PRIORITY (default 6)

Priority levels :

levelmnemonicexplanation
2CRITICALShould be corrected immediately, but indicates failure in a primary system - fix CRITICAL problems before ALERT - an example is loss of primary ISP connection.
3ERRORNon-urgent failures - these should be relayed to developers or admins; each item must be resolved within a given time.
4WARNINGWarning messages - not an error, but indicated that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time.
5NOTICEEvents that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required.
6INFORMATIONALNormal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required.
7DEBUGInfo is useful to developers for debugging the app, not useful during operations.
-S SIZE
Sets the maximum permitted message size to SIZE. The default is 1KiB characters, which is the limit traditionally used and specified in RFC 3164. With RFC 5424, this limit has become flexible. A good assumption is that RFC 5424 receivers can at least process 4KiB messages.

Exit status

Exits 0 on success, and >0 if an error occurs.

Configuration variables

The following configuration variables shall affect the execution of sd_log:

SD_LOG_PRIORITY
contains a number 2-7 that means the minimum message priority level that must be printed by default is 6 (INFORMATIONAL)

Availability

Since SDaaS 4

Examples

sd_log "test message"
write the string “sdaas(5) - test message” on stdout only if SD_LOG_PRIORITY>=5
sd_log -p DEBUG "test message"
write the string “sdaas(7) - test message” on stdout only if SD_LOG_PRIORITY=7
sd_log ERROR "test message"
write the string “sdaas(3) - test message” on stderr

26 - sd_rapper

a wrapper for rapper

Synopsis

sd_rapper ARGUMENTS

Description

It is an interface to the raptor library that converts a RDF into the various serialization. It accepts the same options of the rapper utility having the following options as default:

    -wq 
    -f 'xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"' 
    -f 'xmlns:owl="http://www.w3.org/2002/07/owl#"' 
    -f 'xmlns:foaf="http://xmlns.com/foaf/0.1/"' 
    -f 'xmlns:dc="http://purl.org/dc/elements/1.1/"' 
    -f 'xmlns:dct="http://purl.org/dc/terms/"' 
    -f 'xmlns:dqv="http://www.w3.org/ns/dqv#"' 
    -f 'xmlns:prov="http://www.w3.org/ns/prov#"' 
    -f 'xmlns:sd="http://www.w3.org/ns/sparql-service-description#"' 
    -f 'xmlns:void="http://rdfs.org/ns/void#"' 
    -f 'xmlns:xsd="http://www.w3.org/2001/XMLSchema#"' 
    -f 'xmlns:kees="http://linkeddata.center/kees/v1#"' 
    -f 'xmlns:sdaas="http://linkeddata.center/sdaas/v4#"' 

Exit status

Exits with 0 on success, and > 0 if a curl or http error occurs. In case of http error, all the curl output is logged.

Availability

Since SDaaS 4

Examples

sd_rapper -g https://schema.org/version/latest/schemaorg-current-http.rdf
get the XML resource file and writes ntriple using serialization guess
sd_rapper -i turle https://schema.org/version/latest/schemaorg-current-http.ttl
get the ttl resource file and writes ntriple with explict serialziaztion type

27 - sd_return_first_non_zero

analyze the return of a piped command

Synopsis

sd_return_first_non_zero PIPESTATUS

Used in combiantion with PIPESTATUS bash variable

Exit status

Returns firs non zero value in the arguments

Availability

Since SDaaS 4

Examples

cmd1 | cmd3 | cmd3
sd_return_first_non_zero "${PIPESTATUS[@]}"

28 - sd_sparql_graph

load a set of nTriples into a named graph within a graph store

Synopsis

sd_sparql_graph [-s SID] [ -a ACCRUAL METHOD ] [GRAPH_URI]

Description

Load a stream of nTriples into the GRAPH_URI. No action is performed if an empty data stream is detected.

GRAPH_URI
it is the URI for a named graph in the store that will contain the resource. If GRAPH_URI is unspecified, it uses $(sd_uuid) as the graph name: note that this implies that a new named graph is generated every call even if POST is used as ACCRUAL METHOD.
-a ACCRUAL METHOD
When PUT, the graph will be cleared before loading the data, when POST (default) the data is appended the graph, creating it if it doesn’t exist.
-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success.

Availability

Since SDaaS 4

Examples

sd_curl https://schema.org/version/latest/schemaorg-current-http.nt | sd sparql graph "urn:graph:1"
download and stores the content of the resource into the named graph urn:graph:1
sd_curl https://schema.org/version/latest/schemaorg-current-http.nt | sd sparql graph
same of above but guessing and translating the RDF content of the resource storeing its if to a named graph with random uuid URI

29 - sd_sparql_list

a sparql query alias

This is an alias for sd sparql query -o “csv-h”

Availability

Since SDaaS 4

30 - sd_sparql_query

query a graph store with SPARQL

Synopsis

sd_sparql_query [-D LOCAL CONTEXT] [-s SID] [-o OUT_FORMAT]

Description

execute execute a SPARQL query construct from a SPARQL query string passed in stdin. It returns the results in stdout according the format specified in OUT_FORMAT (default xml). If the specified format is incompatible with the QUERY_COMMAND the selected format fallback to xml

All input and outputs must be in UTF8 charset.

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)
-o OUT_FORMAT -D “out_format=OUT_FORMAT
write result in OUT_FORMAT
OUT_FORMAT
one of these
TypeQuery TypeDescription
csvSELECT
csv-hSELECTSame as csv but without header
csv-1SELECTSame as csv-h, but only the first row is printed
csv-f1SELECTSame as csv-1, but only the first field is printed
booleanASKoutput “true” or “false”
tslSELECT
jsonSELECT
ntriplesCONSTRUCT, DESCRIBE
xmlCONSTRUCT, DESCRIBE
turtleCONSTRUCT, DESCRIBE
rdfxml (default)CONSTRUCT, DESCRIBE
testASK, SELECTreturns 0 if ASK returns true or SELECT results is empty

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

Exits 0 on success, -1 of test fail and > 0 if an error occurs.

Availability

Since SDaaS 4

Examples

cat 'SELECT DISTINCT ?class WHERE { ?s a ?class} LIMIT 10' | sd sparql query -o csv
execute a the sparql SELECT statement returning the result as a CSV stream
cat 'SELECT DISTINCT ?class WHERE { ?s a ?class} LIMIT 10' | sd sparql query -D "out_format=csv"
same as above but using context definition
cat 'ASK ?s WHERE {?s ?p ?o}' | sd sparql query -o boolean
echo “true” if ASK the statement is true
cat'SELECT ?s WHERE { ?s a <urn:type> }' | sd sparql query -o test
return 0 if SELECT the statement returns an empty list

31 - sd_sparql_rule

a sparql query alias

This is an alias for sd sparql query -o ntriples

Availability

Since SDaaS 4

32 - sd_sparql_test

a sparql query alias

This is an alias for sd sparql query -o test

Availability

Since SDaaS 4

33 - sd_sparql_update

update a graph store with SPARQL

Synopsis

sd_sparql_update [-s SID] [-D LOCAL CONTEXT]

Description

execute the SPARQL update string passed stdin

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

0 on success

Availability

Since SDaaS 4

Examples

These equivalent commands execute DROP ALL on the Graph Store named STORE:

echo "DROP ALL" | sd sparql update
echo "DROP ALL" | sd sparql update -s STORE
echo "DROP ALL" | sd sparql update -D "sid=STORE"
# same of above but aborting on failure
DROP ALL" | sd -A sparql update

34 - sd_store_erase

erase a graph store

Synopsis

sd_store_erase [-s SID] [-D LOCAL CONTEXT]

Description

remove all data in the knowledge graph it is functionally equivalent to echo "DROP ALL" | sd sparql update

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

0 on success

Availability

Since SDaaS 4

35 - sd_store_size

return the number of triple un a graph store

Synopsis

sd_store_size [-s SID] [-D LOCAL CONTEXT]

Description

return the number of triple un a graph store. Please note tha in some store engine, for performance reasons, this feature returns an estimated number

-s SID, -D “sid=SID
connect to Graph Store named SID ( STORE by default)

Context

The default context is loaded from the SD_DEFAULT_CONTEXT configuration variable

Exit status

0 on success

Availability

Since SDaaS 4

36 - sd_urlencode

url encode a string

url encode a string substituting unsafe chars

Synopsis

sd_urlencode STRING

Description

url encodes STRING

Availability

Since SDaaS 4

Examples

sd_urlencode "http://w3.org/?test#name>"
write the string http%3A%2F%2Fw3.org%2F%3Ftest%23name%3E"

37 - sd_uuid

generate an uuid

Synopsis

sd_uuid [NAMESPACE]

Description

write an uuid URI minted from NAMESPACE (urn:uuid: by default)

Availability

Since SDaaS 4

Examples

sd_uuid
write the string “un:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” were x represents a random hexadecimal digit
sd_uuid ""
just write the uuid string without any prefix

38 - sd_validate

validate a variable content against a regular expression

Synopsis

sd_validate VARIABLE_NAME REGULAR_EXPRESSION*

Description

validate a variable content against a regular expression

Exit status

Exits 0 on success, and > 0 if an error occurs.

Examples

sd_validate STORE "^http"
test that the content of the variable named STORE begins with http

Availability

Since SDaaS 4

39 - sd_view_agent

describe SDaaS agent properties

Synopsis

sd_view_agent [-o FORMAT ]

Description

print the SDaaS agent in the RDF FORMAT

-o OUT_FORMAT
one of these formats: ntriples(default), turtle, rdfxml

Exit status

Exits 0 on success, and >0 if an error occurs.

Availability

Since SDaaS 4

40 - sd_view_config

display all declared configuration variables

The sd view config displays all defined configuration and driver variables

Synopsys

sd view config

41 - sd_view_module

display all functions exported by a module

Displays all available commands exported by a module with their cache status

Synopsys

sd view commands MODULE (core by default)

MODULE
a module name

Examples:

sd view module core

42 - sd_view_modules

display all modules in SDaaS distribution

Displays all available modules

Synopsys

sd view modules

Examples:

sd view modules

43 - sd_view_ontology

print the SDaaS language Profile

Synopsis

sd_view_ontology [-o FORMAT ]

Description

print the SDaaS language Profile including KESS support in the RDF FORMAT

-o OUT_FORMAT
one of these formats: ntriples(default), turtle, rdfxml

for a definition of all SDaaS Language Profile see the SDaaS Ontology guide to see SDaaS in action

Exit status

Exits 0 on success, and >0 if an error occurs.

Availability

Since SDaaS 4

44 - sd_view_version

print the version of SDaaS interface

Synopsis

sd_view_version

Description

print the version of SDaaS interface

Exit status

Exits 0 on success, and >0 if an error occurs.

Availability

Since SDaaS 4