示例#1
1
		/// <summary>
		/// <see cref="Field.ExportAsTurtleSensorData"/>
		/// </summary>
		public override void ExportAsTurtleSensorData(TurtleWriter w)
		{
			w.WritePredicateUri ("cl", "field");
			w.StartBlankNode ();

			this.ExportAsTurtleSensorDataCommonAttributes(w);

			w.WritePredicateUri ("cl", "enum");
			w.WriteObjectLiteral (this.value);

			w.WritePredicateUri ("cl", "dataType");
			w.WriteObjectLiteral (this.dataType);

			w.EndBlankNode ();
		}
示例#2
1
		/// <summary>
		/// <see cref="Field.ExportAsTurtleSensorData"/>
		/// </summary>
		public override void ExportAsTurtleSensorData(TurtleWriter w)
		{
			w.WritePredicateUri ("cl", "field");
			w.StartBlankNode ();

			this.ExportAsTurtleSensorDataCommonAttributes(w);

			w.WritePredicateUri ("cl", "dateTime");
			w.WriteObjectLiteralTyped (XmlUtilities.DateTimeToString(this.value), "xsd", "dateTime");

			w.EndBlankNode ();
		}
示例#3
1
		/// <summary>
		/// Starts the export of sensor data values for a particular point in time. This call must be followed by a call to <see cref="EndExportTimestamp"/>.
		/// Use <see cref="ExportField"/> to export field  information to the Sensor Data TURTLE document.
		/// </summary>
		/// <param name="Turtle">TURTLE Output</param>
		/// <param name="Timestamp">Timestamp</param>
		public static void StartExportTimestamp (TurtleWriter Turtle, DateTime Timestamp)
		{
			Timestamp = Timestamp.ToUniversalTime ();

			Turtle.WritePredicateUri ("cl", "sample");
			Turtle.StartBlankNode ();

			Turtle.WritePredicateUri ("cl", "timestamp");
			Turtle.WriteObjectLiteralTyped (XmlUtilities.DateTimeToString (Timestamp), "xsd", "dateTime");
		}
示例#4
0
        /// <summary>
        /// <see cref="Field.ExportAsTurtleSensorData"/>
        /// </summary>
        public override void ExportAsTurtleSensorData(TurtleWriter w)
        {
            w.WritePredicateUri("cl", "field");
            w.StartBlankNode();

            this.ExportAsTurtleSensorDataCommonAttributes(w);

            w.WritePredicateUri("cl", "duration");
            w.WriteObjectLiteralTyped(this.value.ToDuration().ToString(), "xsd", "duration");

            w.EndBlankNode();
        }
        /// <summary>
        /// <see cref="Field.ExportAsTurtleSensorData"/>
        /// </summary>
        public override void ExportAsTurtleSensorData(TurtleWriter w)
        {
            w.WritePredicateUri("cl", "field");
            w.StartBlankNode();

            this.ExportAsTurtleSensorDataCommonAttributes(w);

            w.WritePredicateUri("cl", "boolean");
            w.WriteObjectLiteralTyped(this.value);

            w.EndBlankNode();
        }
示例#6
0
        /// <summary>
        /// <see cref="Field.ExportAsTurtleSensorData"/>
        /// </summary>
        public override void ExportAsTurtleSensorData(TurtleWriter w)
        {
            w.WritePredicateUri("cl", "field");
            w.StartBlankNode();

            this.ExportAsTurtleSensorDataCommonAttributes(w);

            w.WritePredicateUri("cl", "dateTime");
            w.WriteObjectLiteralTyped(XmlUtilities.DateTimeToString(this.value), "xsd", "dateTime");

            w.EndBlankNode();
        }
示例#7
0
		/// <summary>
		/// <see cref="Field.ExportAsTurtleSensorData"/>
		/// </summary>
		public override void ExportAsTurtleSensorData(TurtleWriter w)
		{
			w.WritePredicateUri ("cl", "field");
			w.StartBlankNode ();

			this.ExportAsTurtleSensorDataCommonAttributes (w);

			w.WritePredicateUri ("cl", "numeric");
			w.WriteObjectLiteralTyped (this.value);

			//string EncodedUnit = HttpUtilities.UrlEncode (this.unit);
			//
			//if (EncodedUnit == this.unit)
			//	w.WriteObjectLiteralTyped (XmlUtilities.DoubleToString (this.value, this.nrDecimals), "clu", this.unit);
			//else
			//	w.WriteObjectLiteralTyped (XmlUtilities.DoubleToString (this.value, this.nrDecimals), "http://clayster.com/sw/u/" + EncodedUnit);

			w.WritePredicateUri ("cl", "unit");
			w.WriteObjectLiteral (this.unit);

			w.WritePredicateUri ("cl", "nrDec");
			w.WriteObjectLiteralTyped (this.nrDecimals);

			w.EndBlankNode ();
		}
示例#8
0
		/// <summary>
		/// <see cref="Field.ExportAsTurtleSensorData"/>
		/// </summary>
		public override void ExportAsTurtleSensorData(TurtleWriter w)
		{
			w.WritePredicateUri ("cl", "field");
			w.StartBlankNode ();

			this.ExportAsTurtleSensorDataCommonAttributes(w);

			w.WritePredicateUri ("cl", "duration");
			w.WriteObjectLiteralTyped (this.value.ToDuration().ToString(), "xsd", "duration");

			w.EndBlankNode ();
		}
示例#9
0
		/// <summary>
		/// Exports common Field attributes, similar to XEP-0323 Sensor data, but using TURTLE.
		/// </summary>
		/// <param name="w">TURTLE Output</param>
		protected void ExportAsTurtleSensorDataCommonAttributes (TurtleWriter w)
		{
			w.WritePredicateUri ("cl", "name");
			w.WriteObjectLiteral (this.fieldName);

			if ((this.type & ReadoutType.MomentaryValues) != 0)
			{
				w.WritePredicateUri ("cl", "momentary");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.PeakValues) != 0)
			{
				w.WritePredicateUri ("cl", "peak");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.StatusValues) != 0)
			{
				w.WritePredicateUri ("cl", "status");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.Computed) != 0)
			{
				w.WritePredicateUri ("cl", "computed");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.Identity) != 0)
			{
				w.WritePredicateUri ("cl", "identity");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesSecond) != 0)
			{
				w.WritePredicateUri ("cl", "historicalSecond");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesMinute) != 0)
			{
				w.WritePredicateUri ("cl", "historicalMinute");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesHour) != 0)
			{
				w.WritePredicateUri ("cl", "historicalHour");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesDay) != 0)
			{
				w.WritePredicateUri ("cl", "historicalDay");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesWeek) != 0)
			{
				w.WritePredicateUri ("cl", "historicalWeek");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesMonth) != 0)
			{
				w.WritePredicateUri ("cl", "historicalMonth");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesQuarter) != 0)
			{
				w.WritePredicateUri ("cl", "historicalQuarter");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesYear) != 0)
			{
				w.WritePredicateUri ("cl", "historicalYear");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.type & ReadoutType.HistoricalValuesOther) != 0)
			{
				w.WritePredicateUri ("cl", "historicalOther");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.Missing) != 0)
			{
				w.WritePredicateUri ("cl", "missing");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.AutomaticEstimate) != 0)
			{
				w.WritePredicateUri ("cl", "automaticEstimate");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.ManualEstimate) != 0)
			{
				w.WritePredicateUri ("cl", "manualEstimate");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.ManualReadout) != 0)
			{
				w.WritePredicateUri ("cl", "manualReadout");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.AutomaticReadout) != 0)
			{
				w.WritePredicateUri ("cl", "automaticReadout");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.TimeOffset) != 0)
			{
				w.WritePredicateUri ("cl", "timeOffset");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.Warning) != 0)
			{
				w.WritePredicateUri ("cl", "warning");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.Error) != 0)
			{
				w.WritePredicateUri ("cl", "error");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.Signed) != 0)
			{
				w.WritePredicateUri ("cl", "signed");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.Invoiced) != 0)
			{
				w.WritePredicateUri ("cl", "invoiced");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.EndOfSeries) != 0)
			{
				w.WritePredicateUri ("cl", "endOfSeries");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.PowerFailure) != 0)
			{
				w.WritePredicateUri ("cl", "powerFailure");
				w.WriteObjectLiteralTyped (true);
			}

			if ((this.status & FieldStatus.InvoicedConfirmed) != 0)
			{
				w.WritePredicateUri ("cl", "invoiceConfirmed");
				w.WriteObjectLiteralTyped (true);
			}

			if (this.stringIds != null && this.stringIds.Length > 0)
			{
				if (!string.IsNullOrEmpty (this.languageModule))
				{
					w.WritePredicateUri ("cl", "module");
					w.WriteObjectLiteral (this.languageModule);
				}

				w.WritePredicateUri ("cl", "stringIds");
				w.StartObjectSeq ();

				foreach (FieldLanguageStep Step in this.stringIds)
				{
					w.AddItemStartBlankNode ();

					w.WritePredicateUri ("cl", "stringId");
					w.WriteObjectLiteralTyped (Step.StringId);

					if (Step.Seed != null)
					{
						w.WritePredicateUri ("cl", "seed");
						w.WriteObjectLiteral (Step.Seed.ToString ());
					}

					if (!string.IsNullOrEmpty (Step.LanguageModule))
					{
						w.WritePredicateUri ("cl", "module");
						w.WriteObjectLiteral (Step.LanguageModule);
					}

					w.EndBlankNode ();
				}

				w.EndObjectSeq ();
			}
		}
示例#10
-1
		/// <summary>
		/// Starts the export of sensor data values for a particular node. This call must be followed by a call to <see cref="EndExportNode"/>.
		/// Use <see cref="StartExportTimestamp"/> to export node information pertaining to a given point in time to the Sensor Data TURTLE document.
		/// </summary>
		/// <param name="Turtle">TURTLE Output</param>
		/// <param name="NodeId">Node ID.</param>
		/// <param name="CacheType">Cache Type</param> 
		/// <param name="SourceId">Source ID.</param>
		public static void StartExportNode (TurtleWriter Turtle, string NodeId, string CacheType, string SourceId)
		{
			Turtle.WriteSubjectUri ("l", string.Empty);
			Turtle.WritePredicateUri ("cl", "node");
			Turtle.StartBlankNode ();

			Turtle.WritePredicateUri ("cl", "nodeId");
			Turtle.WriteObjectLiteral (NodeId);

			if (!string.IsNullOrEmpty (CacheType))
			{
				Turtle.WritePredicateUri ("cl", "cacheType");
				Turtle.WriteObjectLiteral (CacheType);
			}

			if (!string.IsNullOrEmpty (SourceId))
			{
				Turtle.WritePredicateUri ("cl", "sourceId");
				Turtle.WriteObjectLiteral (SourceId);
			}
		}