@prefix :        <https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionPrototype.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 'SingleTypeConversionPrototype.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Converts from a single typed value to various other types of values.' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman, Mike Hunsberger, Jane Wu' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '15 June 2001' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '15 October 2023' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'type conversion' ;
  x3do:name 'subject' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://www.cs.brown.edu/~gss/VRML98/paper.rev.html' ;
  x3do:name 'reference' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://www.cs.brown.edu/~gss/vrml/hprotos.wrl' ;
  x3do:name 'reference' .
:meta_1_9 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://www.cs.brown.edu/~gss/vrml/hotpot.zip' ;
  x3do:name 'reference' .
:meta_1_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionPrototype.x3d' ;
  x3do:name 'identifier' .
:meta_1_11 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_12 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "SingleTypeConversionPrototype.x3d" .
:meta dcterms:description "Converts from a single typed value to various other types of values." .
:meta dcterms:creator "Don Brutzman, Mike Hunsberger, Jane Wu" .
:meta dcterms:created "15 June 2001" .
:meta dcterms:modified "15 October 2023" .
:meta dcterms:subject "type conversion" .
:meta dcterms:reference "http://www.cs.brown.edu/~gss/VRML98/paper.rev.html" .
:meta dcterms:reference "http://www.cs.brown.edu/~gss/vrml/hprotos.wrl" .
:meta dcterms:reference "http://www.cs.brown.edu/~gss/vrml/hotpot.zip" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionPrototype.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, :Anchor_2_3 ;
  x3do:hasProtoDeclare :ProtoDeclare_2_2 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'SingleTypeConversionPrototype.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 'SingleTypeConversion converts from a single typed value to various other types of values' ;
  x3do:name 'SingleTypeConversion' .
: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_7, :field_2_2_1_8, :field_2_2_1_9, :field_2_2_1_10, :field_2_2_1_11, :field_2_2_1_12 .
:field_2_2_1_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'decimalPlaces is the number of significant digits after the decimal point, use -1 to indicate no round off' ;
  x3do:name 'decimalPlaces' ;
  x3do:type 'SFInt32' ;
  x3do:value -1 .
:field_2_2_1_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'setDecimalPlaces' ;
  x3do:type 'SFInt32' .
:field_2_2_1_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'BooleanValue' ;
  x3do:type 'SFBool' .
:field_2_2_1_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'FloatValue' ;
  x3do:type 'SFFloat' .
:field_2_2_1_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'IntegerValue' ;
  x3do:type 'SFInt32' .
:field_2_2_1_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'TimeValue' ;
  x3do:type 'SFTime' .
:field_2_2_1_7 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'BooleanResult' ;
  x3do:type 'SFBool' .
:field_2_2_1_8 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'FloatResult' ;
  x3do:type 'SFFloat' .
:field_2_2_1_9 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'IntegerResult' ;
  x3do:type 'SFInt32' .
:field_2_2_1_10 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'TimeResult' ;
  x3do:type 'SFTime' .
:field_2_2_1_11 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'StringResult' ;
  x3do:type 'SFString' .
:field_2_2_1_12 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'StringsResult' ;
  x3do:type 'MFString' .
:ProtoBody_2_2_2 a owl:NamedIndividual, x3do:ProtoBody ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasChildren :ConversionScript .
:ConversionScript a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:hasField :field_2_2_2_1_1, :field_2_2_2_1_2, :field_2_2_2_1_3, :field_2_2_2_1_4, :field_2_2_2_1_5, :field_2_2_2_1_6, :field_2_2_2_1_7, :field_2_2_2_1_8, :field_2_2_2_1_9, :field_2_2_2_1_10, :field_2_2_2_1_11, :field_2_2_2_1_12, :field_2_2_2_1_13, :field_2_2_2_1_14, :field_2_2_2_1_15, :field_2_2_2_1_16 ;
  x3do:hasIS :IS_2_2_2_1_17 ;
  x3do:DEF 'ConversionScript' ;
  x3do:sourceCode """
ecmascript:

function initialize()
{
	if (decimalPlaces <= -1)
	{
		roundOffFactor = 1;
	}
	else
	{
		roundOffFactor = Math.pow(10, decimalPlaces);
	}
//	Browser.println ('[SingleTypeConversion initialize()] decimalPlaces=' + decimalPlaces + ', roundOffFactor=' + roundOffFactor);
}
function setDecimalPlaces (value, timeStamp)
{
	decimalPlaces = value;
	initialize ();
}
function SFBoolValue(value, timeStamp)
{
	if (value)
	{
		SFBoolResult   = value;
		SFInt32Result  = 1;
		SFFloatResult  = 1.0;
		SFTimeResult   = timeStamp;
		SFStringResult = '1';
		MFStringResult = new MFString ('1');
	}
	else
	{
		SFBoolResult   = value;
		SFInt32Result  = 0;
		SFFloatResult  = 0.0;
		SFTimeResult   = -1;
		SFStringResult = '0';
		MFStringResult = new MFString ('0');
	}
}
function SFInt32Value(value, timeStamp)
{
	if (value == 0)
		SFBoolResult = false;
	else
		SFBoolResult = true;

	newIntegerValue = value;
        SFInt32Result   = newIntegerValue;
	SFFloatResult   = newIntegerValue * 1.0;
	SFTimeResult    = newIntegerValue * 1.0;
	SFStringResult  = newIntegerValue.toString(); // per EcmaScript specification
        if (SFStringResult == null)
        {
            SFStringResult = newIntegerValue; // try direct approach
        }
	MFStringResult = new MFString(SFStringResult);
}
function SFFloatValue(value, timeStamp)
{
	if (value == 0)
		SFBoolResult = false;
	else
		SFBoolResult = true;

        if (decimalPlaces >= 0)
	     newFloatValue = Math.round(value*roundOffFactor) / roundOffFactor;
	else newFloatValue = value;

	SFInt32Result  = Math.round(newFloatValue);
	SFFloatResult  = newFloatValue;
	SFTimeResult   = newFloatValue;
	SFStringResult = newFloatValue.toString(); // per EcmaScript specification
        if (SFStringResult == null)
        {
          SFStringResult = newFloatValue; // try direct approach
        }
	MFStringResult = new MFString(SFStringResult);
//      Browser.println ('value=' + value + ', SFFloatResult=' + SFFloatResult);
}
function SFTimeValue(value, timeStamp)
{
	if (value == 0.0)
		SFBoolResult = false;
	else
		SFBoolResult = true;

	if (decimalPlaces >= 0)
		newTimeValue = Math.round(value*roundOffFactor) / roundOffFactor;
	else	newTimeValue = value;

	SFInt32Result  = Math.round(newTimeValue);
	SFFloatResult  = newTimeValue;
	SFTimeResult   = newTimeValue;
	SFStringResult = newTimeValue.toString(); // per EcmaScript specification
        if (SFStringResult == null)
        {
            SFStringResult = newTimeValue; // try direct approach
        }
	MFStringResult = new MFString(SFStringResult);
}
""" .
:field_2_2_2_1_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'decimalPlaces' ;
  x3do:type 'SFInt32' .
:field_2_2_2_1_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'setDecimalPlaces' ;
  x3do:type 'SFInt32' .
:field_2_2_2_1_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'SFBoolValue' ;
  x3do:type 'SFBool' .
:field_2_2_2_1_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'SFFloatValue' ;
  x3do:type 'SFFloat' .
:field_2_2_2_1_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'SFInt32Value' ;
  x3do:type 'SFInt32' .
:field_2_2_2_1_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'SFTimeValue' ;
  x3do:type 'SFTime' .
:field_2_2_2_1_7 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'SFBoolResult' ;
  x3do:type 'SFBool' .
:field_2_2_2_1_8 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'SFInt32Result' ;
  x3do:type 'SFInt32' .
:field_2_2_2_1_9 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'SFFloatResult' ;
  x3do:type 'SFFloat' .
:field_2_2_2_1_10 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'SFTimeResult' ;
  x3do:type 'SFTime' .
:field_2_2_2_1_11 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'SFStringResult' ;
  x3do:type 'SFString' .
:field_2_2_2_1_12 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'MFStringResult' ;
  x3do:type 'MFString' .
:field_2_2_2_1_13 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'local temporary variable' ;
  x3do:name 'newIntegerValue' ;
  x3do:type 'SFInt32' ;
  x3do:value 0 .
:field_2_2_2_1_14 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'local temporary variable' ;
  x3do:name 'newFloatValue' ;
  x3do:type 'SFFloat' ;
  x3do:value 0.0 .
:field_2_2_2_1_15 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'local temporary variable' ;
  x3do:name 'newTimeValue' ;
  x3do:type 'SFFloat' ;
  x3do:value 0.0 .
:field_2_2_2_1_16 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ConversionScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'local variable defined as field for persistence' ;
  x3do:name 'roundOffFactor' ;
  x3do:type 'SFFloat' ;
  x3do:value 1 .
:IS_2_2_2_1_17 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :ConversionScript ;
  x3do:hasConnect :connect_2_2_2_1_17_1, :connect_2_2_2_1_17_2, :connect_2_2_2_1_17_3, :connect_2_2_2_1_17_4, :connect_2_2_2_1_17_5, :connect_2_2_2_1_17_6, :connect_2_2_2_1_17_7, :connect_2_2_2_1_17_8, :connect_2_2_2_1_17_9, :connect_2_2_2_1_17_10, :connect_2_2_2_1_17_11, :connect_2_2_2_1_17_12 .
:connect_2_2_2_1_17_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'decimalPlaces' ;
  x3do:protoField 'decimalPlaces' .
:connect_2_2_2_1_17_2 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'setDecimalPlaces' ;
  x3do:protoField 'setDecimalPlaces' .
:connect_2_2_2_1_17_3 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFBoolValue' ;
  x3do:protoField 'BooleanValue' .
:connect_2_2_2_1_17_4 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFFloatValue' ;
  x3do:protoField 'FloatValue' .
:connect_2_2_2_1_17_5 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFInt32Value' ;
  x3do:protoField 'IntegerValue' .
:connect_2_2_2_1_17_6 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFTimeValue' ;
  x3do:protoField 'TimeValue' .
:connect_2_2_2_1_17_7 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFBoolResult' ;
  x3do:protoField 'BooleanResult' .
:connect_2_2_2_1_17_8 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFInt32Result' ;
  x3do:protoField 'IntegerResult' .
:connect_2_2_2_1_17_9 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFFloatResult' ;
  x3do:protoField 'FloatResult' .
:connect_2_2_2_1_17_10 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFTimeResult' ;
  x3do:protoField 'TimeResult' .
:connect_2_2_2_1_17_11 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'SFStringResult' ;
  x3do:protoField 'StringResult' .
:connect_2_2_2_1_17_12 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_17 ;
  x3do:nodeField 'MFStringResult' ;
  x3do:protoField 'StringsResult' .
:Anchor_2_3 a owl:NamedIndividual, x3do:Anchor ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Shape_2_3_1 ;
  x3do:description 'SingleTypeConversion Example' ;
  x3do:url '"SingleTypeConversionExample.x3d" "../../../Savage/Tools/Authoring/SingleTypeConversionExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionExample.x3d" "SingleTypeConversionExample.wrl" "../../../Savage/Tools/Authoring/SingleTypeConversionExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/SingleTypeConversionExample.wrl"' .
:Shape_2_3_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Anchor_2_3 ;
  x3do:hasAppearance :Appearance_2_3_1_1 ;
  x3do:hasGeometry :Text_2_3_1_2 .
:Appearance_2_3_1_1 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasMaterial :Material_2_3_1_1_1 .
:Material_2_3_1_1_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_3_1_1 ;
  x3do:diffuseColor ( 0 1 1 ) ;
  x3do:emissiveColor ( 0 1 1 ) .
:Text_2_3_1_2 a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasFontStyle :FontStyle_2_3_1_2_1 ;
  x3do:string '"SingleTypeConversionPrototype" "is a Prototype definition file." "" "To see an example scene" "select this text and view" "SingleTypeConversionExample"' .
:FontStyle_2_3_1_2_1 a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :Text_2_3_1_2 ;
  x3do:justify '"MIDDLE" "MIDDLE"' ;
  x3do:size 0.8 .
