/// <summary> /// Constructor. /// </summary> /// <param name="component"><seealso cref="ECABaseModel.Component"/> that is to be represented by the RDF endpoint</param> /// <param name="uri">Endpoint listener URI</param> public ComponentDatapoint(Component component, string uri) : base(uri) { graph = new ComponentLDPGraph(new Uri(uri), component); component.SetDatapoint(this); try { lock (ComponentPrototypeManager.RegisteredPrototypes) if (!ComponentPrototypeManager.RegisteredPrototypes.ContainsKey(component.Prototype.Name)) { ComponentPrototypeManager.RegisteredPrototypes.Add(component.Prototype.Name, new ComponentPrototypeDatapoint(component.Prototype, new Uri(uri).getPrototypeBaseUri() + component.Name + "/")); } } catch (HttpListenerException) { } foreach (AttributePrototype a in component.Prototype.AttributePrototypes) { try { new AttributeDatapoint(component[a.Name], uri.TrimEnd('/') + "/" + a.Name); } catch (Exception e) { Console.WriteLine("[ECA2LD.Datapoints.ComponentDatapoint] FAILED to create Attribute Datapoint: {0}", e.Message); } } }
/// <summary> /// Constructor. /// </summary> /// <param name="component"><seealso cref="ECABaseModel.Component"/> that is to be represented by the RDF endpoint</param> /// <param name="uri">Endpoint listener URI</param> public ComponentDatapoint(Component component, string uri) : base(uri) { graph = new ComponentLDPGraph(new Uri(uri), component); try { new ComponentPrototypeDatapoint(component.Prototype, new Uri(uri).getPrototypeBaseUri() + component.Name + "/"); } catch (HttpListenerException) { } foreach (AttributePrototype a in component.Prototype.AttributePrototypes) { new AttributeDatapoint(component[a.Name], uri.TrimEnd('/') + "/" + a.Name); } }