@prefix :        <https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/EventGraphLoopTest.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 '4.0' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-4.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_13, :meta_1_14, :meta_1_15 .
:meta_1_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'EventGraphLoopTest.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Diagnostic scene for tools to test event-graph loop detection' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '4 February 2024' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '4 May 2024' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'includes intentional event loop' ;
  x3do:name 'warning' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/stylesheets/X3dToXhtml.xslt' ;
  x3do:name 'reference' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'EventGraphLoopTestConsoleLog.txt' ;
  x3do:name 'reference' .
:meta_1_9 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'EventGraphLoopTestIndex.html' ;
  x3do:name 'reference' .
:meta_1_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D 4.0 Architecture, ISO/IEC 19775-1:2023, 4 Concepts, 4.4.8.4 Loops' ;
  x3do:name 'specificationSection' .
:meta_1_11 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/concepts.html#Loops' ;
  x3do:name 'specificationUrl' .
:meta_1_12 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D event graph loop detection' ;
  x3do:name 'subject' .
:meta_1_13 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/EventGraphLoopTest.x3d' ;
  x3do:name 'identifier' .
:meta_1_14 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit' ;
  x3do:name 'generator' .
:meta_1_15 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "EventGraphLoopTest.x3d" .
:meta dcterms:description "Diagnostic scene for tools to test event-graph loop detection" .
:meta dcterms:creator "Don Brutzman" .
:meta dcterms:created "4 February 2024" .
:meta dcterms:modified "4 May 2024" .
:meta dcterms:warning "includes intentional event loop" .
:meta dcterms:reference "https://www.web3d.org/x3d/stylesheets/X3dToXhtml.xslt" .
:meta dcterms:reference "EventGraphLoopTestConsoleLog.txt" .
:meta dcterms:reference "EventGraphLoopTestIndex.html" .
:meta dcterms:subject "X3D event graph loop detection" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/EventGraphLoopTest.x3d" .
:meta dcterms:generator "X3D-Edit 4.0, 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, :Background_2_2, :Clock1, :Clock2, :Clock3, :ClockReporter, :RotatingTransform, :LoopCounterTransform, :Spinner ;
  x3do:hasROUTE :ROUTE_2_6, :ROUTE_2_7, :ROUTE_2_8, :ROUTE_2_10, :ROUTE_2_13, :ROUTE_2_15, :ROUTE_2_16 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'EventGraphLoopTest.x3d' .
:Background_2_2 a owl:NamedIndividual, x3do:Background ;
  x3do:hasParent :Scene ;
  x3do:skyColor ( 1 1 0.858824 ) .
:Clock1 a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :Scene ;
  x3do:DEF 'Clock1' ;
  x3do:cycleInterval '8' ;
  x3do:loop true .
:Clock2 a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :Scene ;
  x3do:DEF 'Clock2' ;
  x3do:cycleInterval '2' .
:Clock3 a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :Scene ;
  x3do:DEF 'Clock3' ;
  x3do:cycleInterval '2' .
:ROUTE_2_6 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'cycleTime' ;
  x3do:fromNode 'Clock1' ;
  x3do:toField 'startTime' ;
  x3do:toNode 'Clock2' .
:ROUTE_2_7 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'cycleTime' ;
  x3do:fromNode 'Clock2' ;
  x3do:toField 'startTime' ;
  x3do:toNode 'Clock3' .
:ROUTE_2_8 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'cycleTime' ;
  x3do:fromNode 'Clock3' ;
  x3do:toField 'startTime' ;
  x3do:toNode 'Clock1' .
:ClockReporter a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Scene ;
  x3do:hasField :field_2_9_1, :field_2_9_2, :field_2_9_3, :field_2_9_4, :field_2_9_5, :field_2_9_6 ;
  x3do:DEF 'ClockReporter' ;
  x3do:sourceCode """
ecmascript:


function initialize()
{
    Browser.println ('[Script ClockReporter] initialize()');
}

function clockStart1 (eventValue)
{
    // input eventValue received for inputOutput field
    clockStart1 = eventValue;
    Browser.println ('[Script ClockReporter] clockStart1(' + eventValue + ')');
}

function clockStart2 (eventValue)
{
    // input eventValue received for inputOutput field
    clockStart2 = eventValue;
    Browser.println ('[Script ClockReporter] clockStart2(' + eventValue + ')');
}

function clockStart3 (eventValue)
{
    // input eventValue received for inputOutput field
    clockStart3 = eventValue;
    loopCounter++;
    // send single-line MFString output event to Text node's string field
    loopCounterString = new MFString('loop ' + loopCounter);
    Browser.println ('[Script ClockReporter] clockStart3(' + eventValue + ') received event to start text spinning');
}
""" .
:field_2_9_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'clockStart1' ;
  x3do:type 'SFTime' ;
  x3do:value '-1' .
:field_2_9_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'clockStart2' ;
  x3do:type 'SFTime' ;
  x3do:value '-1' .
:field_2_9_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'clockStart3' ;
  x3do:type 'SFTime' ;
  x3do:value '-1' .
:field_2_9_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:hasChildren :Clock1-USE-1 ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'enable indirect contol of node by this Script' ;
  x3do:name 'handleClock1' ;
  x3do:type 'SFNode' .
:Clock1-USE-1 a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :field_2_9_4 ;
  owl:sameAs :Clock1 . # DEF matching this USE
:field_2_9_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:accessType 'inputOutput' ;
  x3do:appinfo 'loop count' ;
  x3do:name 'loopCounter' ;
  x3do:type 'SFInt32' ;
  x3do:value 0 .
:field_2_9_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ClockReporter ;
  x3do:accessType 'outputOnly' ;
  x3do:appinfo 'display latest loop count' ;
  x3do:name 'loopCounterString' ;
  x3do:type 'MFString' .
:ROUTE_2_10 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'cycleTime' ;
  x3do:fromNode 'Clock3' ;
  x3do:toField 'clockStart3' ;
  x3do:toNode 'ClockReporter' .
:RotatingTransform a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :SpinnableTextShape ;
  x3do:DEF 'RotatingTransform' ;
  x3do:translation ( 0 1 0 ) .
:SpinnableTextShape a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :RotatingTransform ;
  x3do:hasGeometry :Text_2_11_1_1 ;
  x3do:hasAppearance :TextAppearance ;
  x3do:DEF 'SpinnableTextShape' .
:Text_2_11_1_1 a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :SpinnableTextShape ;
  x3do:hasFontStyle :BoldFontStyle ;
  x3do:string '"EventGraphLoopTest" "includes a" "three-ROUTE event loop"' .
:BoldFontStyle a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :Text_2_11_1_1 ;
  x3do:DEF 'BoldFontStyle' ;
  x3do:family '"SANS"' ;
  x3do:justify '"MIDDLE" "MIDDLE"' ;
  x3do:size 0.8 ;
  x3do:cssStyle 'BOLD' .
:TextAppearance a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :SpinnableTextShape ;
  x3do:hasMaterial :Material_2_11_1_2_1 ;
  x3do:DEF 'TextAppearance' .
:Material_2_11_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :TextAppearance ;
  x3do:diffuseColor ( 1 0.4 0.2 ) .
:LoopCounterTransform a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :LoopCounterTextShape ;
  x3do:DEF 'LoopCounterTransform' ;
  x3do:scale ( 0.8 0.8 0.8 ) ;
  x3do:translation ( 0 -1.5 0 ) .
:LoopCounterTextShape a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :LoopCounterTransform ;
  x3do:hasGeometry :LoopCounterText ;
  x3do:hasAppearance :TextAppearance-USE-1 ;
  x3do:DEF 'LoopCounterTextShape' .
:LoopCounterText a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :LoopCounterTextShape ;
  x3do:hasFontStyle :BoldFontStyle-USE-1 ;
  x3do:DEF 'LoopCounterText' ;
  x3do:string '"loop 0"' .
:BoldFontStyle-USE-1 a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :LoopCounterText ;
  owl:sameAs :BoldFontStyle . # DEF matching this USE
:TextAppearance-USE-1 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :LoopCounterTextShape ;
  owl:sameAs :TextAppearance . # DEF matching this USE
:ROUTE_2_13 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'loopCounterString' ;
  x3do:fromNode 'ClockReporter' ;
  x3do:toField 'string' ;
  x3do:toNode 'LoopCounterText' .
:Spinner a owl:NamedIndividual, x3do:OrientationInterpolator ;
  x3do:hasParent :Scene ;
  x3do:DEF 'Spinner' ;
  x3do:key ( 0 0.3333 0.6667 1 ) ;
  x3do:keyValue ( 0 1 0 0 0 1 0 2.094395 0 1 0 4.18879 0 1 0 0 ) .
:ROUTE_2_15 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'fraction_changed' ;
  x3do:fromNode 'Clock3' ;
  x3do:toField 'set_fraction' ;
  x3do:toNode 'Spinner' .
:ROUTE_2_16 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'value_changed' ;
  x3do:fromNode 'Spinner' ;
  x3do:toField 'rotation' ;
  x3do:toNode 'RotatingTransform' .
