Skip to content
Snippets Groups Projects
MMTConstants.cs 16.6 KiB
Newer Older
using System;
using System.Collections.Generic;
using UnityEngine;

namespace REST_JSON_API
{
    /// <summary>
    /// Collection of MMT URIs and mappings to C\# types (if applicable)
    /// </summary>
    public static class MMTConstants
    {
        public static readonly string Point = "http://mathhub.info/MitM/core/geometry?3DGeometry?point";
        public static readonly string ScalarProduct = "http://mathhub.info/MitM/core/geometry?3DGeometry?scalar_productI";
        public static readonly string PointSubtractI = "http://mathhub.info/MitM/core/geometry?3DGeometry?point_subtractI";
        public static readonly string PointAddI = "http://mathhub.info/MitM/core/geometry?3DGeometry?point_addI";
        public static readonly string VecMultI = "http://mathhub.info/MitM/core/geometry?3DGeometry?vec_multI";
        public static readonly string VecCross = "http://mathhub.info/MitM/core/geometry?3DGeometry?vec_cross";

        public static readonly string LineType = "http://mathhub.info/MitM/core/geometry?Geometry/Common?line_type";
        public static readonly string LineOf = "http://mathhub.info/MitM/core/geometry?Geometry/Common?lineOf";

MaZiFAU's avatar
MaZiFAU committed
        public static readonly string Wall = "http://mathhub.info/FrameIT/frameworld?Walls?wall";
        public static readonly string CreateWall = "http://mathhub.info/FrameIT/frameworld?Walls?create_wall";
        public static readonly string Triangle = "http://mathhub.info/FrameIT/frameworld?Triangles?wall";
        public static readonly string CreateTriangle = "http://mathhub.info/FrameIT/frameworld?Triangles?create_wall";
        public static readonly string OnLine = "http://mathhub.info/MitM/core/geometry?Geometry/Common?onLine";
        public static readonly string Ded = "http://mathhub.info/MitM/Foundation?Logic?ded";
        public static readonly string Eq = "http://mathhub.info/MitM/Foundation?Logic?eq";
        public static readonly string Metric = "http://mathhub.info/MitM/core/geometry?Geometry/Common?metric";
        public static readonly string Angle = "http://mathhub.info/MitM/core/geometry?Geometry/Common?angle_between";
        public static readonly string Sketch = "http://mathhub.info/MitM/Foundation?InformalProofs?proofsketch";
        public static readonly string RealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?real_lit";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string Bool = "http://cds.omdoc.org/urtheories?Bool?BOOL";
        public static readonly string Proposition = "http://mathhub.info/MitM/Foundation?Logic?prop";

        public static readonly string ParallelLine = "http://mathhub.info/MitM/core/geometry?Geometry/Common?parallelLine";
        //public static readonly string RectangleFact = "http://mathhub.info/FrameIT/frameworld?FrameITRectangles?rectangleType";
        //public static readonly string RectangleFactmk = "http://mathhub.info/FrameIT/frameworld?FrameITRectangles?mkRectangle";

        public static readonly string CircleType3d = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?circleType3D";
        public static readonly string MkCircle3d = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?circle3D";
        public static readonly string TriangleMiddlePoint = "http://mathhub.info/FrameIT/frameworld?FrameITTriangles?triangleMidPointWrapper";
        public static readonly string RadiusCircleMetric = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?circleRadius";

        public static readonly string AreaCircle = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?areaCircle";
        public static readonly string VolumeCone = "http://mathhub.info/FrameIT/frameworld?FrameITCone?volumeCone";
        public static readonly string ConeOfCircleApex = "http://mathhub.info/FrameIT/frameworld?FrameITCone?circleConeOf";

        public static readonly string ParametrizedPlane = "http://mathhub.info/MitM/core/geometry?Planes?ParametrizedPlane";
        public static readonly string pointNormalPlane = "http://mathhub.info/MitM/core/geometry?Planes?pointNormalPlane";
        public static readonly string OnCircle = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?pointOnCircle";
        public static readonly string AnglePlaneLine = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?angleCircleLine";
        public static readonly string OrthoCircleLine = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?orthogonalCircleLine";

        public static readonly string TruncatedVolumeCone = "http://mathhub.info/FrameIT/frameworld?FrameITCone?truncatedConeVolume";
        public static readonly string CylinderVolume = "http://mathhub.info/FrameIT/frameworld?FrameITCylinder?cylinderVolume";
        public static readonly string EqualityCircles = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?equalityCircles";
        public static readonly string UnEqualityCircles = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?unequalityCircles";

        public static readonly string ParallelCircles = "http://mathhub.info/FrameIT/frameworld?FrameITCone?parallelCircles";
        public static readonly string RightAngle = "http://mathhub.info/FrameIT/frameworld?FrameITBasics?rightAngle";

        public static readonly string AttachedPositionFunction = "0SET_IN_MMTConstants!";
        public static readonly string FunctionCallFact = "1SET_IN_MMTConstants!";
        public static readonly string FunctionFact = "2SET_IN_MMTConstants!";

        public static readonly string TestType = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?xcircleType3D";

        public static readonly string Product = "http://gl.mathhub.info/MMT/LFX/Sigma?Symbols?Product";
        public static readonly string Tuple = "http://gl.mathhub.info/MMT/LFX/Sigma?Symbols?Tuple";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string MakeType = "http://gl.mathhub.info/MMT/LFX/Records?Symbols?Recexp";
        public static readonly string MakeTypeType = "http://gl.mathhub.info/MMT/LFX/Records?Symbols?Rectype";
        public static readonly string TypeType = "http://cds.omdoc.org/urtheories?Typed?type";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string GetField = "http://gl.mathhub.info/MMT/LFX/Records?Symbols?Getfield";

        public static readonly string ListType = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?ListType";
        public static readonly string ListApplicant = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?list";
        public static readonly string ListLiteral = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?cons";
        public static readonly string ListEnd = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?nil_constant";

        public static readonly string AddRealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?plus_real_lit";
        public static readonly string MinusRealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?minus_real_lit";
        public static readonly string InvertRealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?inv_real_lit";
        public static readonly string TimesRealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?times_real_lit";
        public static readonly string RealMultiplication = "http://mathhub.info/MitM/core/arithmetics?RealArithmetics?multiplication";
        public static readonly string LEQRealLit = "http://mathhub.info/MitM/Foundation?RealLiterals?leq_real_lit";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string IfThenElse = "http://mathhub.info/FrameIT/frameworld?IfThenElseX?ifthenelsex";
        public static readonly string ProjL = "http://gl.mathhub.info/MMT/LFX/Sigma?Symbols?Projl";
        public static readonly string ProjR = "http://gl.mathhub.info/MMT/LFX/Sigma?Symbols?Projr";
        public static readonly string Map = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListOperations?map";

        public static readonly string PartialAggregate = "?Step";
        public static readonly string FeedForwardWhile = "http://mathhub.info/FrameIT/frameworld?StepUntil?stepUntil";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string FeedForwardWhile2 = "http://mathhub.info/FrameIT/frameworld?W3DBouncingScroll?stepUntil";
        public static readonly string FeedForwardWhileT2 = "http://mathhub.info/FrameIT/frameworld?T3DBouncingScroll?stepUntil";
        public static readonly string Filter = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListOperations?filter";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string Filter2 = "http://mathhub.info/FrameIT/frameworld?W3DBouncingScroll?filter2";
        public static readonly string FilterT2 = "http://mathhub.info/FrameIT/frameworld?T3DBouncingScroll?filter2";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string Fold = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListOperations?fold";
        public static readonly string IndexList = "http://mathhub.info/FrameIT/frameworld?GetListAtInd?getListAtInd";
        public static readonly string ToArray = "?ToArray";
        public static readonly string Invoke = "?lambda";
        public static readonly string Sin = "http://mathhub.info/MitM/Foundation?Trigonometry?sin";
        public static readonly string Cos = "http://mathhub.info/MitM/Foundation?Trigonometry?cos";
        public static readonly string Divide = "Divide";
MaZiFAU's avatar
MaZiFAU committed
        public static readonly string SquareRoot = "http://mathhub.info/MitM/Foundation?RealLiterals?sqrt";
        public static readonly string LessThan = "LessThan";
        //public static readonly string MakeUnityEngineVector3 = "UnityEngine.Vector3";
        public static readonly string MakeObjectArray = "MakeObjectArray";
        public static readonly string PropertyX = "http://mathhub.info/MitM/core/geometry?3DGeometry?xofpoint";
        public static readonly string PropertyY = "http://mathhub.info/MitM/core/geometry?3DGeometry?yofpoint";
        public static readonly string PropertyZ = "http://mathhub.info/MitM/core/geometry?3DGeometry?zofpoint";

        public const string ScrollOppositeLen = "http://mathhub.info/FrameIT/frameworld?OppositeLen";
        public const string ScrollSupplementaryAngles = "http://mathhub.info/FrameIT/frameworld?SupplementaryAngles";
        public const string ScrollAngleSum = "http://mathhub.info/FrameIT/frameworld?AngleSum";
        public const string ScrollPythagoras = "http://mathhub.info/FrameIT/frameworld?Pythagoras";
        public const string ScrollCylinderVolumeScroll = "http://mathhub.info/FrameIT/frameworld?CylinderVolumeScroll";
        public const string ScrollCircleLineAngleToAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleToAngleScroll";
        public const string ScrollMidpoint = "http://mathhub.info/FrameIT/frameworld?Midpoint";
        public const string ScrollCircleScroll = "http://mathhub.info/FrameIT/frameworld?CircleScroll";
        public const string ScrollCircleLineAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleScroll";
        public const string ScrollCircleAreaScroll = "http://mathhub.info/FrameIT/frameworld?CircleAreaScroll";
        public const string ScrollConeVolumeScroll = "http://mathhub.info/FrameIT/frameworld?ConeVolumeScroll";
        public const string ScrollTruncatedConeVolumeScroll = "http://mathhub.info/FrameIT/frameworld?TruncatedConeVolumeScroll";
        public const string ScrollCannonBall2D = "http://mathhub.info/FrameIT/frameworld?WBouncingScroll";
        public const string ScrollCannonBall3D = "http://mathhub.info/FrameIT/frameworld?W3DBouncingScroll";
        public const string ScrollCannonBallT3D = "http://mathhub.info/FrameIT/frameworld?T3DBouncingScroll";
MaZiFAU's avatar
MaZiFAU committed
        public const string ScrollRiver = "http://mathhub.info/FrameIT/frameworld?RiverScroll";
        /// <summary>
        /// <remark>Needs to map to primitives where possible!</remark>
        /// </summary>
        public static readonly IReadOnlyDictionary<string, Type> OMS_TO_TYPE = new Dictionary<string, Type>()
        {
            { Metric,
                typeof(LineFact) },
            { Triangle,
                typeof(TriangleFact) },
            { Angle,
                typeof(AngleFact) },
            { Eq,
                typeof(RightAngleFact) },
            { RightAngle,
                typeof(RightAngleFact) },
            { LineType,
                typeof(RayFact) },
            { LineOf,
                typeof(RayFact) },
            { OnLine,
                typeof(OnLineFact) },
            { ParallelLine,
                typeof(ParallelLineFact) },
            { CircleType3d,
                typeof(CircleFact) },
            { OnCircle,
                typeof(OnCircleFact) },
            { AnglePlaneLine,
                typeof(AngleCircleLineFact) },
            { RadiusCircleMetric,
                typeof(RadiusFact) },
            { AreaCircle,
                typeof(AreaCircleFact) },
            { OrthoCircleLine,
                typeof(OrthogonalCircleLineFact) },
            { VolumeCone,
                typeof(ConeVolumeFact) },
            { TruncatedVolumeCone,
                typeof(TruncatedConeVolumeFact) },
            { CylinderVolume,
                typeof(CylinderVolumeFact) },
            { TestType,
                typeof(TestFact) },
            { EqualityCircles,
                typeof(EqualCirclesFact) },
            { UnEqualityCircles,
                typeof(UnEqualCirclesFact) },
            { FunctionFact,
                typeof(FunctionFact) },
            { FunctionCallFact,
                typeof(FunctionCallFact) },

            { RealLit,
                typeof(float) },
MaZiFAU's avatar
MaZiFAU committed
            { Bool,
                typeof(bool) },
MaZiFAU's avatar
MaZiFAU committed
                typeof(TupleFact) },
            { Product,
                typeof(Tuple) },
            { ListType,
                typeof(List<>) },

            { AddRealLit,
                typeof(Func<,,>).MakeGenericType(typeof(float), typeof(float), typeof(float)) },
            { MinusRealLit,
                typeof(Func<,,>).MakeGenericType(typeof(float), typeof(float), typeof(float)) },
            { Proposition,
                typeof(bool) }, //typeof(Func<,>).MakeGenericType(Type.MakeGenericMethodParameter(0), typeof(bool)) },
            { ProjL, // how?
                typeof(Func<,>) }, //.MakeGenericType(typeof(Tuple))
            { MkCircle3d, typeof(CircleFact) },
            { ConeOfCircleApex, typeof(ConeVolumeFact) },

            { Ded, null },
            { Sketch, null },
            { TriangleMiddlePoint, null },
            { ParametrizedPlane, null },
            { pointNormalPlane, null },
            { ParallelCircles, null },

            { typeof(float).ToString(),
                typeof(float) },
            { typeof(double).ToString(),
                typeof(double) },
            { typeof(string).ToString(),
                typeof(string) },
            { typeof(Vector3).ToString(),
                typeof(Vector3) }
        };
        public static readonly IReadOnlyDictionary<Type, string> TYPE_TO_OMS = OMS_TO_TYPE.ReverseKeyValInto(new()
        { // **Overrides**
MaZiFAU's avatar
MaZiFAU committed
          { typeof(uint),
              "NaN" },
          { typeof(int),
              "NaN" },
        });

        public static readonly IReadOnlyDictionary<string, string> URI_TO_TypeOF = new Dictionary<string, string> {
            { MkCircle3d,
                CircleType3d },
            { LineOf,
                LineType },
            { CreateTriangle,
                Triangle },
            { CreateWall,
                Wall },
        };
        public static readonly IReadOnlyDictionary<string, string> TypeOF_TO_URI = URI_TO_TypeOF.ReverseKeyVal();

        public static readonly IReadOnlyDictionary<string, string> HeterogenApplication_TO_TypeOF = new Dictionary<string, string> {
            { Tuple,
                Product },
            { Product,
                Product },
MaZiFAU's avatar
MaZiFAU committed
            { MakeType,
                MakeTypeType },
            { MakeTypeType,
                MakeTypeType },
        };
        public static readonly IReadOnlyDictionary<string, string> TypeOF_TO_HeterogenApplication = HeterogenApplication_TO_TypeOF.ReverseKeyVal();

        public static readonly IReadOnlyDictionary<string, string> HomogenApplication_TO_TypeOF = new Dictionary<string, string> {
            { ListApplicant,
                ListType },
        };
        public static readonly IReadOnlyDictionary<string, string> TypeOF_TO_HomogenApplication = HomogenApplication_TO_TypeOF.ReverseKeyVal();
MaZiFAU's avatar
MaZiFAU committed

MaZiFAU's avatar
MaZiFAU committed
        //TODO: Make this dynamic
        //public static readonly IReadOnlyDictionary<string, int> ApplicationSelector_TO_Index = new Dictionary<string, int> {
        //    { GetField,
        //        1 },
        //};