Esempio n. 1
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 ();
			}
		}