@prefix :        <https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorPrototype.ttl#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema:  <http://schema.org/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix x3d:     <https://www.web3d.org/specifications/x3d-4.0.xsd#> .
@prefix x3do:    <https://www.web3d.org/specifications/X3dOntology4.0#> .

:X3D a owl:NamedIndividual, x3do:X3D ;
  x3do:hasHead :head ;
  x3do:hasScene :Scene ;
  x3do:profile 'Immersive' ;
  x3do:version '3.0' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-3.0.xsd' .
:head a owl:NamedIndividual, x3do:head ;
  x3do:hasParent :X3D ;
  x3do:hasMeta :meta_1_1, :meta_1_2, :meta_1_3, :meta_1_4, :meta_1_5, :meta_1_6, :meta_1_7, :meta_1_8, :meta_1_9, :meta_1_10, :meta_1_11, :meta_1_12 .
:meta_1_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'TimeDelaySensorPrototype.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Time delay sensor design pattern, implemented as a reusable prototype node.' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman and MV4204 class' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '29 August 2003' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '28 November 2019' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'TimeDelaySensorExample.x3d' ;
  x3do:name 'reference' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/technicalinfo/specifications/vrml97/part1/concepts.html#4.6.8' ;
  x3do:name 'reference' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#CoordinateInterpolator' ;
  x3do:name 'reference' .
:meta_1_9 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'TimeDelaySensor' ;
  x3do:name 'subject' .
:meta_1_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorPrototype.x3d' ;
  x3do:name 'identifier' .
:meta_1_11 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' ;
  x3do:name 'generator' .
:meta_1_12 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "TimeDelaySensorPrototype.x3d" .
:meta dcterms:description "Time delay sensor design pattern, implemented as a reusable prototype node." .
:meta dcterms:creator "Don Brutzman and MV4204 class" .
:meta dcterms:created "29 August 2003" .
:meta dcterms:modified "28 November 2019" .
:meta dcterms:reference "TimeDelaySensorExample.x3d" .
:meta dcterms:reference "https://www.web3d.org/technicalinfo/specifications/vrml97/part1/concepts.html#4.6.8" .
:meta dcterms:reference "https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#CoordinateInterpolator" .
:meta dcterms:subject "TimeDelaySensor" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorPrototype.x3d" .
:meta dcterms:generator "X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit" .
:meta dcterms:license "../../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :Anchor_2_3 ;
  x3do:hasProtoDeclare :ProtoDeclare_2_2 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'TimeDelaySensorPrototype.x3d' .
:ProtoDeclare_2_2 a owl:NamedIndividual, x3do:ProtoDeclare ;
  x3do:hasParent :Scene ;
  x3do:hasProtoInterface :ProtoInterface_2_2_1 ;
  x3do:hasProtoBody :ProtoBody_2_2_2 ;
  x3do:appinfo 'TimeSensor functionality commences after delayInterval pause' ;
  x3do:name 'TimeDelaySensor' .
:ProtoInterface_2_2_1 a owl:NamedIndividual, x3do:ProtoInterface ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasField :field_2_2_1_1, :field_2_2_1_2, :field_2_2_1_3, :field_2_2_1_4, :field_2_2_1_5, :field_2_2_1_6 .
:field_2_2_1_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'describe the purpose of this sensor' ;
  x3do:name 'description' ;
  x3do:type 'SFString' .
:field_2_2_1_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'whether sensor is active' ;
  x3do:name 'enabled' ;
  x3do:type 'SFBool' ;
  x3do:value true .
:field_2_2_1_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'when current time exceeds startTime, isActive becomes true and sensor becomes active' ;
  x3do:name 'startTime' ;
  x3do:type 'SFTime' ;
  x3do:value '0' .
:field_2_2_1_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'seconds' ;
  x3do:name 'delayInterval' ;
  x3do:type 'SFTime' ;
  x3do:value '1' .
:field_2_2_1_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'delayCompleteTime' ;
  x3do:type 'SFTime' .
:field_2_2_1_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'traceEnabled' ;
  x3do:type 'SFBool' ;
  x3do:value false .
:ProtoBody_2_2_2 a owl:NamedIndividual, x3do:ProtoBody ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasChildren :Group_2_2_2_1 .
:Group_2_2_2_1 a owl:NamedIndividual, x3do:Group ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:hasChildren :TimeDelayClock, :TimeDelayScript ;
  x3do:hasROUTE :ROUTE_2_2_2_1_3 .
:TimeDelayClock a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :Group_2_2_2_1 ;
  x3do:hasIS :IS_2_2_2_1_1_1 ;
  x3do:DEF 'TimeDelayClock' .
:IS_2_2_2_1_1_1 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :TimeDelayClock ;
  x3do:hasConnect :connect_2_2_2_1_1_1_1, :connect_2_2_2_1_1_1_2, :connect_2_2_2_1_1_1_3 .
:connect_2_2_2_1_1_1_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1_1 ;
  x3do:nodeField 'startTime' ;
  x3do:protoField 'startTime' .
:connect_2_2_2_1_1_1_2 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1_1 ;
  x3do:nodeField 'enabled' ;
  x3do:protoField 'enabled' .
:connect_2_2_2_1_1_1_3 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1_1 ;
  x3do:nodeField 'cycleInterval' ;
  x3do:protoField 'delayInterval' .
:TimeDelayScript a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Group_2_2_2_1 ;
  x3do:hasField :field_2_2_2_1_2_1, :field_2_2_2_1_2_2, :field_2_2_2_1_2_3, :field_2_2_2_1_2_4, :field_2_2_2_1_2_5, :field_2_2_2_1_2_6, :field_2_2_2_1_2_7 ;
  x3do:hasIS :IS_2_2_2_1_2_8 ;
  x3do:DEF 'TimeDelayScript' ;
  x3do:directOutput true ;
  x3do:sourceCode """
ecmascript:

//  inputOnly events are handled by functions,
//  initializeOnly fields are variable objects,
//  outputOnly events are handled by setting values

function initialize ()
{
	priorDelayInterval = LocalTimeDelayClock.cycleInterval;
	tracePrint ('initial delayInterval=' + priorDelayInterval + ' seconds');
}
function tracePrint (outputString)
{
	if (traceEnabled) Browser.println ('[TimeDelaySensor] ' + outputString);
}
function set_description (newDescription)
{
    description = newDescription;
}
function set_fraction (currentFraction, timestamp)  // from LocalTimeDelayClock
{
	if (priorDelayInterval != LocalTimeDelayClock.cycleInterval)
	{
		priorDelayInterval = LocalTimeDelayClock.cycleInterval;
		tracePrint ('changed delayInterval=' + priorDelayInterval + ' seconds');
	}
	if (!delayStarted)
	{
		delayStarted = true;
		tracePrint ('delay start time=' + timestamp);
	}
	tracePrint ('set_fraction=' + currentFraction);
	if (currentFraction >= 1.0)
	{
		delayCompleteTime = timestamp;  // send output event
		tracePrint ('delayCompleteTime=' + delayCompleteTime);
		delayStarted = false;
	}
}
""" .
:field_2_2_2_1_2_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'describe the purpose of this sensor' ;
  x3do:name 'description' ;
  x3do:type 'SFString' .
:field_2_2_2_1_2_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'set_fraction' ;
  x3do:type 'SFFloat' .
:field_2_2_2_1_2_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'delayCompleteTime' ;
  x3do:type 'SFTime' .
:field_2_2_2_1_2_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:hasChildren :TimeDelayClock-USE-1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'LocalTimeDelayClock' ;
  x3do:type 'SFNode' .
:TimeDelayClock-USE-1 a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :field_2_2_2_1_2_4 ;
  owl:sameAs :TimeDelayClock . # DEF matching this USE
:field_2_2_2_1_2_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'priorDelayInterval' ;
  x3do:type 'SFTime' ;
  x3do:value '1' .
:field_2_2_2_1_2_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'delayStarted' ;
  x3do:type 'SFBool' ;
  x3do:value false .
:field_2_2_2_1_2_7 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :TimeDelayScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'traceEnabled' ;
  x3do:type 'SFBool' .
:IS_2_2_2_1_2_8 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :TimeDelayScript ;
  x3do:hasConnect :connect_2_2_2_1_2_8_1, :connect_2_2_2_1_2_8_2, :connect_2_2_2_1_2_8_3 .
:connect_2_2_2_1_2_8_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_2_8 ;
  x3do:nodeField 'description' ;
  x3do:protoField 'description' .
:connect_2_2_2_1_2_8_2 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_2_8 ;
  x3do:nodeField 'delayCompleteTime' ;
  x3do:protoField 'delayCompleteTime' .
:connect_2_2_2_1_2_8_3 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_2_8 ;
  x3do:nodeField 'traceEnabled' ;
  x3do:protoField 'traceEnabled' .
:ROUTE_2_2_2_1_3 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Group_2_2_2_1 ;
  x3do:fromField 'fraction_changed' ;
  x3do:fromNode 'TimeDelayClock' ;
  x3do:toField 'set_fraction' ;
  x3do:toNode 'TimeDelayScript' .
:Anchor_2_3 a owl:NamedIndividual, x3do:Anchor ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Shape_2_3_1 ;
  x3do:description 'TimeDelaySensor Example' ;
  x3do:url '"TimeDelaySensorExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorExample.x3d" "TimeDelaySensorExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorExample.wrl"' .
:Shape_2_3_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Anchor_2_3 ;
  x3do:hasGeometry :Text_2_3_1_1 ;
  x3do:hasAppearance :Appearance_2_3_1_2 .
:Text_2_3_1_1 a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasFontStyle :FontStyle_2_3_1_1_1 ;
  x3do:string '"TimeDelaySensorPrototype" "defines a prototype" "" "Click text to see" "TimeDelaySensorExample scene"' .
:FontStyle_2_3_1_1_1 a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :Text_2_3_1_1 ;
  x3do:justify '"MIDDLE" "MIDDLE"' ;
  x3do:size 0.7 .
:Appearance_2_3_1_2 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasMaterial :Material_2_3_1_2_1 .
:Material_2_3_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_3_1_2 ;
  x3do:diffuseColor ( 1 1 0.2 ) .
