@prefix :        <https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiAddDynamicRoutes.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_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ECMAScriptSaiAddDynamicRoutes.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Java Scene Authoring Interface (JSAI) scene and source code example that show adding dynamic ROUTEs to a scene.' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D Working Group' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '23 February 2005' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '28 September 2025' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/files/specifications/19777-1/V3.3/Part1/X3D_ECMAScript.html' ;
  x3do:name 'reference' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D language bindings, ISO/IEC 19777-1, Part 1: ECMAScript, B.5 Add dynamic routes' ;
  x3do:name 'specificationSection' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/files/specifications/19777-1/V3.3/Part1/examples.html#AddDynamicRoutes' ;
  x3do:name 'specificationUrl' .
:meta_1_9 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_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiAddDynamicRoutes.x3d' ;
  x3do:name 'identifier' .
:meta_1_11 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "ECMAScriptSaiAddDynamicRoutes.x3d" .
:meta dcterms:description "Java Scene Authoring Interface (JSAI) scene and source code example that show adding dynamic ROUTEs to a scene." .
:meta dcterms:creator "X3D Working Group" .
:meta dcterms:created "23 February 2005" .
:meta dcterms:modified "28 September 2025" .
:meta dcterms:reference "https://www.web3d.org/files/specifications/19777-1/V3.3/Part1/X3D_ECMAScript.html" .
:meta dcterms:generator "X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiAddDynamicRoutes.x3d" .
:meta dcterms:license "../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :SC .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'ECMAScriptSaiAddDynamicRoutes.x3d' .
:SC a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Scene ;
  x3do:hasField :field_2_2_1, :field_2_2_2 ;
  x3do:DEF 'SC' ;
  x3do:url '"ECMAScriptSaiAddDynamicRoutes.js" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiAddDynamicRoutes.js"' ;
  x3do:sourceCode """
ecmascript:

function touchTime(value) {
    // Create nodes directly in the parent scene
    var scene = Browser.currentScene;

    var shape = scene.createNode('Shape');
    var box   = scene.createNode('Box');
    var touchSensor = scene.createNode('TouchSensor');
    shape.geometry = box;

    // Create a Group to hold the nodes
    var group = scene.createNode('Group');

    // Add the shape and sensor to the group
    group.children = new MFNode(shape, touchSensor);

    // Add the nodes to the scene
    scene.RootNodes[0] = group;

    // Add a route from the touchSensor to this script
    scene.addRoute(touchSensor, 'touchTime', Script, 'touchTime');
}
""" .
:field_2_2_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :SC ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'touchTime' ;
  x3do:type 'SFTime' .
:field_2_2_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :SC ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'Script' ;
  x3do:type 'SFNode' .
