<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xsl-for-template-specification.xsl"?>
<TemplateSpecification xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xml-schema-for-template-specification.xsd">
	<TemplateName>ParticipationOfPhysicalObjectInActivity</TemplateName>
	<defaultRdsId>35E40B2C22CC44999CDD3B83F5C6481C</defaultRdsId>
	<Status>updated MAR2024</Status>
	<TIPPredicate>participatesInActivity</TIPPredicate>
	<Description>A PhysicalObject participates, in a given Role, in an Activity, on a given dateTime.</Description>
	<Example>Pump P-101/AN4582483, the implemention of P-101 with asset numbered AN4582483, participates on 2021-09-21T18:44:00Z in the Activiy A457438 (declared as PUMPING) in the Role of PERFORMER.</Example>
	<Notes>At instantiation of this template it is mandatory to add meta:valEffectiveDate with the dateTime that the represented information became effective.</Notes>
	<SubClassOf>TemplateForIndividualActivity</SubClassOf>
	<Definition>[EssentialType] individual [hasParticipant] participates in [EssentialType] Activity [hasActivity] in the Role of [hasParticipantRole].</Definition>
	<ScopeNote>Use this template for the start of long-lasting activities, such as process activities.</ScopeNote>
	<AdminNote/>
	<LiftedAndLoweredGraph>IN-ACTIV-020-20240220.png</LiftedAndLoweredGraph>
	<LiftedTemplate>
	    	<LiftedTemplateElements><Ref>1</Ref><URI>dm:Activity</URI></LiftedTemplateElements>
	    	<LiftedTemplateElements><Ref>2</Ref><URI>dm:PhysicalObject</URI></LiftedTemplateElements>  		
		<LiftedTemplateElements><Ref>3</Ref><URI>dm:Role</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>4</Ref><URI>dm:RepresentationOfGregorianDateAndUtcTime</URI></LiftedTemplateElements>
	    	<LiftedTemplateElements><Ref>5</Ref><URI>dm:SpecializationByRole</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>6</Ref><URI>dm:ParticipatingRoleAndDomain</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>7</Ref><URI>dm:ClassOfParticipation</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>8</Ref><URI>dm:Classification</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>9</Ref><URI>dm:TemporalWholePart</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>10</Ref><URI>dm:Activity</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>11</Ref><URI>dm:Participation</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>12</Ref><URI>dm:PhysicalObject</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>13</Ref><URI>dm:TemporalWholePart</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>14</Ref><URI>dm:Beginning</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>15</Ref><URI>dm:Beginning</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>16</Ref><URI>dm:PointInTime</URI></LiftedTemplateElements>
		<LiftedTemplateElements><Ref>17</Ref><URI>dm:ClassOfIdentification</URI></LiftedTemplateElements>
	</LiftedTemplate>
	<PropertiesOfLoweredTemplate>
  		<TemplateSignature><RoleNo>1</RoleNo><RoleName>hasActivity</RoleName><RoleObjectType>dm:Activity</RoleObjectType><RoleExample/></TemplateSignature>
		<TemplateSignature><RoleNo>2</RoleNo><RoleName>hasParticipant</RoleName><RoleObjectType>dm:PhysicalObject</RoleObjectType><RoleExample/></TemplateSignature>
		<TemplateSignature><RoleNo>3</RoleNo><RoleName>hasParticipantRole</RoleName><RoleObjectType>dm:Role</RoleObjectType><RoleExample>use ID from RDL </RoleExample></TemplateSignature>
	</PropertiesOfLoweredTemplate>
	<LoweredTemplateOWLcode>
    		<![CDATA[
		]]>
	</LoweredTemplateOWLcode>
<LoweredTemplateFOLcode>
<![CDATA[ParticipationOfPhysicalObjectInActivity(hasActivity, hasParticipant, hasParticipantRole) <->
	Activity(hasActivity) &
	PhysicalObject(hasParticipant) &
	Role(hasParticipantRole) &
	exists u1 exists u2 exists u3 exists u4 exists u5 exists u6(
       		SpecializationByRoleTemplate(u5, hasParticipantRole) &
       		RoleAndDomain(u5) &
       		classOfPart(u6, u5) &
       		ClassOfParticipation(u6) &
       		ClassificationTemplate(u2, u6) &
       		TemporalWholePartTemplate(u1, hasActivity) &
       		Activity(u1) &
       		ParticipationTriple(u2, u3, u1) &
       		TemporalWholePartTemplate(u3, hasParticipant) &
       		PhysicalObject(u3) &
       		BeginningTemplate(u4, u1) &
       		BeginningTemplate(u4, u3) &
       		PointInTime(u4) &
       		ClassOfIdentificationTemplate(u7, u4) &
		RepresentationOfGregorianDateAndUtcTime(u7)).
	]]>
</LoweredTemplateFOLcode>

<LoweredTemplateInstanceListing>
<![CDATA[GENERIC DEFINITION

tpl:ParticipationOfPhysicalObjectInActivity
	rdfs:subClassOf dm:Template ;
	rdfs:isDefinedBy  tpl:IN-ACTIV-020.xml ;
	tpl:hasActivity dm:Activity ;
	tpl:hasParticipant dm:PhysicalObject ;
	tpl:hasParticipantRole dm:Role ;
	meta:valEffectiveDate xsd:dateTime .

# EXAMPLE - Pump P-101/AN4582483 (NOTE - the implemention of P-101 with asset numbered AN4582483) participates in the Activiy A457438 (NOTE - declared as PUMPING) in the Role of PERFORMER.

ex:605753d4-9218-4f29-a102-d44b43babb78
	rdf:type tpl:ParticipationOfPhysicalObjectInActivity ;
	tpl:hasActivity ex:b19c7864-7cff-494b-8bcb-c49246302dfb ; # A457438
	tpl:hasParticipant ex:43974c9d-610d-4fc6-8ac9-26216cbc0652 ; # P-101/AN4582483
	tpl:hasParticipantRole rdl:RDS222365 ; # PERFORMER
	meta:valEffectiveDate "2022-09-21T18:44:00Z"^^xsd:dateTime .
]]>
</LoweredTemplateInstanceListing>
<SPARQLqueryListing>
<![CDATA[prefix p7: <http://data.15926.org/p7/> 
prefix xsd: <http://www.w3.org/2001/XMLSchema#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix rdl: <http://data.15926.org/rdl/> 
prefix meta: <http://data.15926.org/meta/> 
prefix ex: <https://example.org/data/> 
SELECT ?templateID ?templateType ?activityLabel ?participantLabel ?roleLabel  ?effectiveDate ?deprecationDate
WHERE {
	?participantID rdfs:label ?participantLabel ;
	FILTER (?participantLabel  = "[PARTICIPANT LABEL]") . # input
	FILTER NOT EXISTS { ?participantID meta:valDeprecationDate ?deprecationDate } . # if not interested in data of deprecated participant

	?templateID ?p ?participantID  .
	?templateID rdf:type ?templateType .

	?templateID p7:hasActivity ?activityID .
	SERVICE <[PROJECT ENDPOINT]> { ?activityID rdfs:label ?activityLabel . } .

	?templateID p7:hasParticipantRole ?roleID .	
	 SERVICE <[RDL ENDPOINT]> { ?roleID rdfs:label ?roleLabel . } .

	?templateID meta:valEffectiveDate ?effectiveDate .

	OPTIONAL { ?templateID meta:valDeprecationDate ?deprecationDate } .
	FILTER NOT EXISTS {?templateID meta:valDeprecationDate ?deprecationDate }  . # if not interested in data of deprecated template
] .
	]]>
</SPARQLqueryListing>
</TemplateSpecification>
