public CogwheelEqsysFact(int i, int[] ids) { this.Id = i; this.CogwheelIds = ids; List <MMTTerm> typeArguments = new List <MMTTerm> { new OMS(MMTURIs.Prop) }; List <int> cogwheelIdList = new List <int>(this.CogwheelIds); List <MMTTerm> listArguments = new List <MMTTerm>(); cogwheelIdList .Select(cogwheelId => new OMS((GameState.Facts.Find(x => x.Id == cogwheelId) as CogwheelFact).backendURI)) .ToList() .ForEach(oms => listArguments.Add(oms)); List <MMTTerm> eqsysArguments = new List <MMTTerm> { new OMA(new OMS(MMTURIs.ListOf), listArguments) }; MMTTerm tp = new OMA(new OMS(MMTURIs.List), typeArguments); MMTTerm df = new OMA(new OMS(MMTURIs.CogwheelEquationSystem), eqsysArguments); MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); string body = MMTSymbolDeclaration.ToJson(mmtDecl); AddFactResponse res = AddFactResponse.sendAdd(GameSettings.ServerAdress + "/fact/add", body); this.backendURI = res.uri; Debug.Log(this.backendURI); }
public CogwheelFact(int i, Vector3 P, Vector3 N, float R, float iR, float oR) { this.Id = i; this.Point = P; this.Normal = N; this.Radius = R; this.InsideRadius = iR; this.OutsideRadius = oR; List <MMTTerm> tupleArguments = new List <MMTTerm> { new OMF(P.x), new OMF(P.y), new OMF(P.z) }; List <MMTTerm> wheelOfArguments = new List <MMTTerm> { new OMF(this.Radius), new OMF(this.InsideRadius), new OMF(this.OutsideRadius), new OMA(new OMS(MMTURIs.Tuple), tupleArguments) }; MMTTerm tp = new OMS(MMTURIs.Cogwheel); MMTTerm df = new OMA(new OMS(MMTURIs.CogwheelOf), wheelOfArguments); MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); string body = MMTSymbolDeclaration.ToJson(mmtDecl); AddFactResponse res = AddFactResponse.sendAdd(GameSettings.ServerAdress + "/fact/add", body); this.backendURI = res.uri; Debug.Log(this.backendURI); }
private void init(string pid, string rid) { this.Pid = pid; this.Rid = rid; PointFact pf = _Facts[pid] as PointFact; RayFact rf = _Facts[rid] as RayFact; string pURI = pf.Id; string rURI = rf.Id; List <MMTTerm> innerArguments = new List <MMTTerm> { new OMS(rURI), new OMS(pURI) }; List <MMTTerm> outerArguments = new List <MMTTerm> { new OMA(new OMS(MMTURIs.OnLine), innerArguments) }; //OMS constructor generates full URI MMTTerm tp = new OMA(new OMS(MMTURIs.Ded), outerArguments); MMTTerm df = null; MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); AddFactResponse.sendAdd(mmtDecl, out this._URI); }
private void init(Vector3 P, Vector3 N) { this.Point = P; this.Normal = N; List <MMTTerm> arguments = new List <MMTTerm> { new OMF(P.x), new OMF(P.y), new OMF(P.z) }; //OMS constructor generates full URI MMTTerm tp = new OMS(MMTURIs.Point); MMTTerm df = new OMA(new OMS(MMTURIs.Tuple), arguments); MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); AddFactResponse.sendAdd(mmtDecl, out this._URI); }
private void init(string pid1, string pid2) { PointFact pf1 = _Facts[pid1] as PointFact; PointFact pf2 = _Facts[pid2] as PointFact; string p1URI = pf1.Id; string p2URI = pf2.Id; List <MMTTerm> arguments = new List <MMTTerm> { new OMS(p1URI), new OMS(p2URI) }; //OMS constructor generates full URI MMTTerm tp = new OMS(MMTURIs.LineType); MMTTerm df = new OMA(new OMS(MMTURIs.LineOf), arguments); MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); AddFactResponse.sendAdd(mmtDecl, out this._URI); }
public static bool sendAdd(MMTDeclaration mmtDecl, out string uri) { string body = MMTSymbolDeclaration.ToJson(mmtDecl); return(sendAdd(CommunicationEvents.ServerAdress + "/fact/add", body, out uri)); }