Extension:LinkedWiki/lua

LinkedWiki provides a Lua Scribunto interface that implements functions to access data from RDF databases with SPARQL endpoints. If Scribunto is installed in your wiki, Lua modules and wiki templates can invoke these functions and the Linkedwiki Class.

Quick start
Usually, the part Lua of LinkedWiki used in infoboxes. Here, you can see an example with an infobox :

The module of this infobox will be :

Constructor : build a new object
uses the configuration by default uses the configuration of     uses the configuration of   but with the language of

Returns a LinkedWiki object.

select the subject of triples

select the configuration in order to read/write or delete the triples of this object in the database.If nil, it uses the configuration by default.

If nil, it uses the language in the configuration.

Enable the debug mode.

Examples :

Config
Returns configuration id (string) used by this instance.(see details about configurations)

Returns nil. It changes the configuration of this instance.



Example :

Lang
Returns lang tag (string) used by this instance.

Returns nil. It changes the lang tag of this instance.



Example :

Subject
Returns subject (iri/string) used by this instance.

Returns nil. It changes the subject of this instance.

Example :

initConfig
Returns nil

Useful only before using a static function in order to initialize the configuration, the language and the debug mode.

Iri or litteral without language tag
Returns the value IRI or litteral without language tag of current subject with this property.



Example :

litteral with language tag
Returns the litteral with this language tag in function of current subject with this property.



If nil, it uses the lang tag by default.

Example :

Iri
Returns nil. It saves one IRI in function of the storage method defined in the configuration.





Example :

Value without language tag
Returns nil. It saves one value without a lang tag in function of the storage method defined in the configuration.





If nil, the database will use the SPARQL standard in order to choose the type. For example, if the value is 7, the database will use xsd:integer but with the value 7.1, it will use xsd:float or xsd:double.

Example without explicit type :

Example with a date :

Example with a double :

String
Returns nil. It saves one string with a lang tag in function of the storage method defined in the configuration.





If nil, the default lang tag in the configuration will be used.

Example :

Other cases
Returns nil. It saves one litteral with a specific type and tag language tag in function of the storage method defined in the configuration.

Delete data
Returns nil. It deletes all triples with the current subject of the instance in function of the storage method defined in the configuration.

Example :

Debug
TODO example