@prefix :        <https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiCreateNodes.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 'ECMAScriptSaiCreateNodes.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 using createX3DFromString to create nodes.' ;
  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.3 Create nodes' ;
  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#CreateNodes' ;
  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/ECMAScriptSaiCreateNodes.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 "ECMAScriptSaiCreateNodes.x3d" .
:meta dcterms:description "Java Scene Authoring Interface (JSAI) scene and source code example that show using createX3DFromString to create nodes." .
: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/ECMAScriptSaiCreateNodes.x3d" .
:meta dcterms:license "../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :HOLDER, :SC ;
  x3do:hasROUTE :ROUTE_2_4 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'ECMAScriptSaiCreateNodes.x3d' .
:HOLDER a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Scene ;
  x3do:DEF 'HOLDER' ;
  x3do:translation ( -2 0 0 ) .
:SC a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Scene ;
  x3do:hasField :field_2_3_1 ;
  x3do:DEF 'SC' ;
  x3do:sourceCode """
ecmascript:
function initialize() {
    // Create nodes directly in the parent scene
    shape = Browser.currentScene.createNode('Shape');
    box = Browser.currentScene.createNode('Box');
    shape.geometry = box;
    Browser.currentScene.RootNodes[0] = shape;

    // Create children using the createX3DFromString service
    vrmlCmd = 'PROFILE Interchange  Shape { geometry Sphere{} }'
    tmpScene = Browser.createX3DFromString(vrmlCmd);
    nodes = tmpScene.rootNodes;

    // Nodes must be removed before adding to another scene
    for(i=0; i < nodes.length; i++) {
        tmpScene.removeRootNode(nodes[i]);
    }
    children = nodes;
}
""" .
:field_2_3_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :SC ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'children' ;
  x3do:type 'MFNode' .
:ROUTE_2_4 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'children' ;
  x3do:fromNode 'SC' ;
  x3do:toField 'children' ;
  x3do:toNode 'HOLDER' .
