<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://wiki.serverdev-mediawiki-v1/" />
<title>lua_core</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">lua_core</td></tr>
</thead><tbody>
<tr>
	<td>store</td>
	<td>javascript{&quot;TestPage&quot;+Math.random()}</td>
	<td>Title</td>
</tr>
<tr>
	<td>open</td>
	<td>/index.php?title=Module:LinkedWikiTest${Title}&amp;action=edit</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=wpTextbox1</td>
	<td>-- @copyright (c) 2016 Bourdercloud.com<br />-- @author Karima Rafes &lt;karima.rafes@bordercloud.com&gt;<br />-- @link http://www.mediawiki.org/wiki/Extension:LinkedWiki<br />-- @license CC-by-nc-sa V3.0<br />--<br />--&nbsp;&nbsp;Last version : http://github.com/BorderCloud/LinkedWiki<br />--<br />--<br />-- This work is licensed under the Creative Commons<br />-- Attribution-NonCommercial-ShareAlike 3.0<br />-- Unported License. To view a copy of this license,<br />-- visit http://creativecommons.org/licenses/by-nc-sa/3.0/<br />-- or send a letter to Creative Commons,<br />-- 171 Second Street, Suite 300, San Francisco,<br />-- California, 94105, USA.<br /><br />--[[<br />-- Debug console<br /><br />mw.log(p.tests() )<br />]]<br /><br />local p = {}<br /><br />function p.checkLitteral(query, litteral)<br />&nbsp;&nbsp;&nbsp;&nbsp;local result = ''<br />&nbsp;&nbsp;&nbsp;&nbsp;if string.match(query, litteral) then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;OK&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;KO&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;end<br />&nbsp;&nbsp;&nbsp;&nbsp;return result<br />end<br /><br /><br />function p.checkString(val1, val2)<br />&nbsp;&nbsp;&nbsp;&nbsp;local result = ''<br />&nbsp;&nbsp;&nbsp;&nbsp;if (val1 ==&nbsp;&nbsp;nil or val2 ==&nbsp;&nbsp;nil) then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;KO&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if val1 ==&nbsp;&nbsp;val2 then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;OK&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;KO&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />&nbsp;&nbsp;&nbsp;&nbsp;end<br />&nbsp;&nbsp;&nbsp;&nbsp;return result<br />end<br />function p.checkNumber(val1, val2)<br />&nbsp;&nbsp;&nbsp;&nbsp;local result = ''<br />&nbsp;&nbsp;&nbsp;&nbsp;if (val1 ==&nbsp;&nbsp;nil or val2 ==&nbsp;&nbsp;nil) then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;KO&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if tonumber(val1) ==&nbsp;&nbsp;tonumber(val2) then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;OK&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = &quot;KO&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />&nbsp;&nbsp;&nbsp;&nbsp;end<br />&nbsp;&nbsp;&nbsp;&nbsp;return result<br />end<br /><br /><br />function p.tests(f)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local linkedwiki = require 'linkedwiki'<br />&nbsp;&nbsp;&nbsp;&nbsp;local endpoint = 'http://database-test:8890/sparql'<br />&nbsp;&nbsp;&nbsp;&nbsp;local config = 'http://database-test'<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local xsd = 'http://www.w3.org/2001/XMLSchema#'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local pr = 'http://database-test/Property:'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local html = '== TESTS =='.. '\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;linkedwiki.setDebug(true)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : linkedwiki.getCurrentIRI()&quot; .. '\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. linkedwiki.getCurrentIRI() .. '\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;linkedwiki.setConfig(config)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local subject = linkedwiki.getCurrentIRI();<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : linkedwiki.explode&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local str1 = &quot;&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;local str2 = &quot;el1&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;local str3 = &quot;el1;el2&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;local arrTestExplode1 = linkedwiki.explode(&quot;;&quot;,str1)<br />&nbsp;&nbsp;&nbsp;&nbsp;local arrTestExplode2 = linkedwiki.explode(&quot;;&quot;,str2)<br />&nbsp;&nbsp;&nbsp;&nbsp;local arrTestExplode3 = linkedwiki.explode(&quot;;&quot;,str3)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : 0==&quot; ..table.getn(arrTestExplode1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : 1==&quot; ..table.getn(arrTestExplode2).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : 2==&quot; ..table.getn(arrTestExplode3).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : getValue &amp; addPropertyWithIri without default subject&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject(subject))<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot; .. pr..'Test'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithIri(pr..'type',pr..'Test',subject))<br />&nbsp;&nbsp;&nbsp;&nbsp;local tabStr = linkedwiki.getValue(pr..'type',subject)<br />--&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.getLastQuery())<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr = linkedwiki.explode(&quot;;&quot;,tabStr)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />--&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..tabStr.. '\n'<br />--<br />--&nbsp;&nbsp;&nbsp;&nbsp;for i, iri in ipairs(arr) do<br />--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html = html .. i .. &quot; : &quot; .. iri .. '\n'<br />--&nbsp;&nbsp;&nbsp;&nbsp;end<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot; .. pr..'Test2'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithIri(pr..'type',pr..'Test2',subject))<br />&nbsp;&nbsp;&nbsp;&nbsp;local tabStr2 = linkedwiki.getValue(pr..'type',subject)<br />--&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.getLastQuery())<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr2 = linkedwiki.explode(&quot;;&quot;,tabStr2)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr2).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr2), 2).. ' \n'<br />--&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..tabStr2.. '\n'<br />--<br />--&nbsp;&nbsp;&nbsp;&nbsp;for i, iri in ipairs(arr2) do<br />--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html = html .. i .. &quot; : &quot; .. iri .. '\n'<br />--&nbsp;&nbsp;&nbsp;&nbsp;end<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject(subject))<br />&nbsp;&nbsp;&nbsp;&nbsp;local tabStr3 = linkedwiki.getValue(pr..'type',subject)<br />--&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.getLastQuery())<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr3 = linkedwiki.explode(&quot;;&quot;,tabStr3)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr3).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr3), 0).. ' \n'<br />--&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..tabStr3.. '\n'<br />--<br />--&nbsp;&nbsp;&nbsp;&nbsp;for i, iri in ipairs(arr3) do<br />--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html = html .. i .. &quot; : &quot; .. iri .. '\n'<br />--&nbsp;&nbsp;&nbsp;&nbsp;end<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : getValue &amp; addPropertyWithIri with default subject&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;linkedwiki.setSubject(subject)<br />&nbsp;&nbsp;&nbsp;&nbsp;linkedwiki.removeSubject() -- delete all triples of this subject<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot; .. pr..'Test'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithIri(pr..'type',pr..'Test'))<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pr..'type'))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot; .. pr..'Test2'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithIri(pr..'type',pr..'Test2'))<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr2 = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pr..'type'))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr2).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr2), 2).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr3 = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pr..'type'))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr3), 0).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : getValue &amp; addPropertyWithLitteral&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;--linkedwiki.addPropertyWithLitteral(iriProperty, value, type, tagLang, iriSubject)<br />&nbsp;&nbsp;&nbsp;&nbsp;--default lang is en in extension.json<br />&nbsp;&nbsp;&nbsp;&nbsp;local pT =''<br />&nbsp;&nbsp;&nbsp;&nbsp;local litteral=''<br />&nbsp;&nbsp;&nbsp;&nbsp;local query=''<br />&nbsp;&nbsp;&nbsp;&nbsp;local result = &quot;&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;local arr = {}<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : text with lang tag &quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'1'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;@en'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert text === &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;--mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'2'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;@en'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;,nil)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;,nil))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;--mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'3'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;@fr'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;,nil,&quot;fr&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;,nil,&quot;fr&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;--mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'4'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;,nil,&quot;&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;,nil,&quot;&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'5'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;,nil,nil)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;,nil,nil))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'6'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='\&quot;\&quot;\&quot;text\&quot;\&quot;\&quot;'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;,nil,nil)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;,nil,nil))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : integer&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'7'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='2'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',2)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,2))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : decimal&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'8'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='&quot;2&quot;^^&lt;'..xsd..&quot;decimal&quot;..'&gt;'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',2,xsd..&quot;decimal&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,2,xsd..&quot;decimal&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(arr[1], 2).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'9'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='2.1'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',2.1)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,2.1))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(arr[1], 2.1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'10'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='&quot;2.1&quot;^^&lt;'..xsd..&quot;decimal&quot;..'&gt;'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',2.1,xsd..&quot;decimal&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,2.1,xsd..&quot;decimal&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(arr[1], 2.1).. ' \n'<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : without default subject&quot; ..'\n'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;local subject2 = linkedwiki.getCurrentIRI()..&quot;2&quot;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'11'<br />&nbsp;&nbsp;&nbsp;&nbsp;litteral='2'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call&nbsp;&nbsp;Linkedwiki.addPropertyWithLitteral('..pT..',2,nil,nil,subject2)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;Insert &quot;..litteral..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,2,nil,nil,subject2))<br />&nbsp;&nbsp;&nbsp;&nbsp;query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; .. p.checkLitteral(query,litteral) ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT,subject2))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr), 1).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(arr[1], 2).. ' \n'<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;----------------------------------------------------------------------------&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : text with lang tag + function getString&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;--linkedwiki.getString(iriProperty, tagLang, iriSubject)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pT = pr..'12'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..'Call Linkedwiki.addPropertyWithLitteral('..pT..',&quot;text2&quot;,nil,&quot;fr&quot;)'..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.addPropertyWithLitteral(pT,&quot;text2&quot;,nil,&quot;fr&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;--query= linkedwiki.getLastQuery()<br />&nbsp;&nbsp;&nbsp;&nbsp;--mw.log(query)<br />&nbsp;&nbsp;&nbsp;&nbsp;arr = linkedwiki.explode(&quot;;&quot;,linkedwiki.getValue(pT))<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : Found &quot; ..table.getn(arr).. ' triple\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkNumber(table.getn(arr),2).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkString(linkedwiki.getString(pT), &quot;text&quot;).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkString(linkedwiki.getString(pT,&quot;en&quot;), &quot;text&quot;).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkString(linkedwiki.getString(pT,&quot;fr&quot;), &quot;text2&quot;).. ' \n'<br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;RESULT : &quot; ..p.checkString(linkedwiki.getString(pT,&quot;fr&quot;,subject), &quot;text2&quot;).. ' \n'<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;html = html ..&quot;TEST : removeSubject&quot; ..'\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;mw.log(linkedwiki.removeSubject())<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;return &quot;&lt;nowiki&gt;&lt;pre&gt;&quot;..mw.text.encode( html)..&quot;&lt;/pre&gt;&lt;/nowiki&gt;&quot;<br />end<br /><br />return p</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=wpSave</td>
	<td></td>
</tr>
<tr>
	<td>open</td>
	<td>/index.php/LinkedWikiTestLua${Title}?action=edit</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=wpTextbox1</td>
	<td>{{#invoke: LinkedWikiTest${Title} | tests}}</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=wpSave</td>
	<td></td>
</tr>
<tr>
	<td>open</td>
	<td>/index.php/LinkedWikiTestLua${Title}?action=purge</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>css=input.mw-htmlform-submit</td>
	<td></td>
</tr>
<tr>
	<td>verifyText</td>
	<td>//div[@id='mw-content-text']/pre</td>
	<td>*TEST :*</td>
</tr>
<tr>
	<td>verifyNotText</td>
	<td>//div[@id='mw-content-text']/pre</td>
	<td>*KO*</td>
</tr>
</tbody></table>
</body>
</html>
