/// <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 (); }
/// <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 (); }
/// <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(); }
/// <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(); }
/// <summary> /// Stops exporting a timestamp. This call must be made for every call made to <see cref="StartExportTimestamp"/>. /// </summary> /// <param name="Turtle">TURTLE Output</param> public static void EndExportTimestamp (TurtleWriter Turtle) { Turtle.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", "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 (); }
/// <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> /// 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 (); } }