Anonymous
Not logged in
English
Log in
Request account
BrineRIS Dataspace
Search
Changes
From BrineRIS Dataspace
Namespaces
Module
Discussion
More
More
Languages
Page actions
Read
View source
History
Create page
Create subpage
Purge
← Older edit
Module:LabProcess/Object
(view source)
Revision as of 04:49, 18 November 2022
785 bytes added
,
04:49, 18 November 2022
Updated with content from Extension:OpenSemanticLab version 0.0.3
Line 14:
Line 14:
if args['custom_id'] ~= nil and args['custom_id'] ~= "" and args['custom_id_pattern'] ~= nil and args['custom_id_replace'] then
if args['custom_id'] ~= nil and args['custom_id'] ~= "" and args['custom_id_pattern'] ~= nil and args['custom_id_replace'] then
args['custom_id'] = string.gsub(args['custom_id'], args['custom_id_pattern'], args['custom_id_replace'])
args['custom_id'] = string.gsub(args['custom_id'], args['custom_id_pattern'], args['custom_id_replace'])
+
end
+
+
if args['label'] ~= nil and args['label'] ~= "" and args['name'] ~= nil and args['name'] then
+
args['label'] = args['name']
end
end
Line 57:
Line 61:
'LabProcessObject'
'LabProcessObject'
}
}
−
end
+
end
+
+
-- calculate consumed/remaining quantity
+
properties["HasQuantifyingQuantity"] = "Property:HasNumberOfEntities" --default
+
properties["HasNumberOfEntities"] = 1 - p.getConsumedQuantity(page.fullText .. "#" .. subobjectId)
mw.logObject(properties)
mw.logObject(properties)
Line 186:
Line 194:
end
end
return result
return result
+
end
+
+
function p.getConsumedQuantity(obj)
+
--mw.logObject(obj)
+
local query = "[[HasPredecessor::" .. obj .. "]] |headers=hide |?#-=page |mainlabel=- |format=plain"
+
local result = mw.smw.ask( query )
+
local consumed = 0
+
if result ~= nil then
+
--mw.logObject(result)
+
for num, row in pairs( result ) do
+
--mw.logObject(row['page'])
+
consumed = consumed + 1
+
end
+
--mw.logObject(result)
+
end
+
return consumed
end
end
Maintenance script
631
edits
Cookies help us deliver our services. By using our services, you agree to our use of cookies.
More information
OK
Navigation
Navigation
Main page
Recent changes
Random page
Editor-Tutorial
New
Page
Subpage
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
Userpage tools
More
Printable version