Module:Analyse des macrophages méthode 2

From DAAP
Jump to navigation Jump to search

Documentation for this module may be created at Module:Analyse des macrophages méthode 2/doc

local p = {}

function GetFileName(url)
  return url:match("^.+/(.+)$")
end

function GetFileExtension(url)
  return url:match("^.+(%..+)$")
end

function GetCampaignIri(url)
  return url:match("^(.+)/SlideInCampaign.+$")
end

function p.Slide(f)
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   local project = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Analyse_des_macrophages#'
   local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   
    local linkedwiki = require 'linkedwiki'
    linkedwiki.setCurrentFrame(mw.getCurrentFrame())
    
   local subject = f.args.iri or linkedwiki.getCurrentIRI();

   
    local campaign =  linkedwiki.new(subject)
    local filesDestination= campaign:getValue(daapp..'filesFinalDestination')
    local dateStr = f.args.Date
	local medium = f.args['Medium'];
	local idSlide = f.args['Slide id'];

	local labelSlide = string.format("%s_L%02d",medium,idSlide)
	local slideIri = subject.."/"..dateStr..labelSlide
	
	
	local labelSlideImage = string.format("%s%s_L%02d",dateStr,medium,idSlide)..'.fsm'
	local labelSlideImageIri = filesDestination..'/'..labelSlideImage
	
	local template= tostring(linkedwiki.getCurrentTitle())..'/SlideInCampaign'..medium
--	local pageCellWithoutId= tostring(linkedwiki.getCurrentTitle())..'/SlideInCampaign'..labelSlide..'_cell'
--	local iriCellWithoutId= tostring(linkedwiki.getCurrentIRI())..'/SlideInCampaign'..labelSlide..'_cell'
	
	mw.log(campaign:addPropertyWithIri(project..'hasSlide',slideIri))
    local slide =  linkedwiki.new(slideIri)
    slide:removeSubject();
    mw.log(slide:addPropertyWithIri(rdf..'type',project..'SlideInCampaign'))
    mw.log(slide:addPropertyString(rdfs..'label',labelSlide,""))
	mw.log(slide:addPropertyWithIri(project..'hasPicture', labelSlideImageIri))
	mw.log(slide:addPropertyWithIri(project..'celltype', project..'J774'))
	mw.log(slide:addPropertyWithIri(project..'medium', project..medium))
	
	local result = '*Slide :'..labelSlide..' \n'
	result = result .. '*Date : '..dateStr..'  \n'
	result = result .. '*Medium : '..medium..' \n'
	result = result .. '*Picture : ['..labelSlideImageIri..' '..labelSlideImage..'] \n'
	return result
end


function p.Medium(f)
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   local project = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Analyse_des_macrophages#'
   local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   
    local linkedwiki = require 'linkedwiki'
    linkedwiki.setCurrentFrame(mw.getCurrentFrame())
    
   local subject = f.args.iri or linkedwiki.getCurrentIRI();

   
    local campaign =  linkedwiki.new(subject)
    local filesDestination= campaign:getValue(daapp..'filesFinalDestination')
    local dateStr = f.args.Date
	local medium = f.args['Medium'];
	local idMedium = f.args['Medium id'];

	local labelMedium = string.format("%s_mc%02d",medium,idMedium)
	local mediumIri = subject.."/"..dateStr..labelMedium
	
	
	local labelMediumImage = string.format("%s%s_mc%s",dateStr,medium,idMedium)..'.fsm'
	local labelMediumImageIri = filesDestination..'/'..labelMediumImage
	
	local template= tostring(linkedwiki.getCurrentTitle())..'/SlideInCampaign'..medium
--	local pageCellWithoutId= tostring(linkedwiki.getCurrentTitle())..'/SlideInCampaign'..labelSlide..'_cell'
--	local iriCellWithoutId= tostring(linkedwiki.getCurrentIRI())..'/SlideInCampaign'..labelSlide..'_cell'
	
	mw.log(campaign:addPropertyWithIri(project..'hasSlide',mediumIri))
    local slide =  linkedwiki.new(mediumIri)
    slide:removeSubject();
    mw.log(slide:addPropertyWithIri(rdf..'type',project..'Medium'))
    mw.log(slide:addPropertyString(rdfs..'label',labelMedium,""))
	mw.log(slide:addPropertyWithIri(project..'hasPicture', labelMediumImageIri))
	--mw.log(slide:addPropertyWithIri(project..'celltype', project..'J774'))
	mw.log(slide:addPropertyWithIri(project..'medium', project..medium))
	
	local result = '*Date : '..dateStr..'  \n'
	result = result .. '*Medium : '..medium..' \n'
	result = result .. '*Picture : ['..labelMediumImageIri..' '..labelMediumImage..'] \n'
	return result
end

function p.Background(f)
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   local project = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Analyse_des_macrophages#'
   local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local daapp = 'http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Project#'
   
    local linkedwiki = require 'linkedwiki'
    linkedwiki.setCurrentFrame(mw.getCurrentFrame())
    
   local subject = f.args.iri or linkedwiki.getCurrentIRI();

   
    local campaign =  linkedwiki.new(subject)
    local filesDestination= campaign:getValue(daapp..'filesFinalDestination')
    local dateStr = f.args.Date

	local labelBackground = string.format("%s_Background",dateStr)
	local backgroundIri = subject.."/"..dateStr..'_Background'
	
	
	local labelBackgroundImage = string.format("%s_Background",dateStr)..'.sp'
	local labelBackgroundImageIri = filesDestination..'/'..labelBackgroundImage
	
--	local template= tostring(linkedwiki.getCurrentTitle())..'/SlideInCampaign'..background

    local background =  linkedwiki.new(backgroundIri)
    background:removeSubject();
    mw.log(background:addPropertyWithIri(rdf..'type',project..'Background'))
    mw.log(background:addPropertyString(rdfs..'label',labelBackground,""))
	mw.log(background:addPropertyWithIri(project..'hasPicture', labelBackgroundImageIri))

	local result = 'Background : ['..labelBackgroundImageIri..' '..labelBackgroundImage..'] \n'
	return result
end

return p