Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TurtleDocument.cs
1using System;
3using System.Net.Http;
4using System.Numerics;
5using System.Text;
6using System.Threading.Tasks;
13
15{
19 public enum BlankNodeIdMode
20 {
24 Sequential,
25
29 Guid
30 }
31
38 {
39 private readonly Dictionary<string, string> namespaces = new Dictionary<string, string>
40 {
41 { "xsd", XmlSchema.Namespace },
42 { "ttl", "http://www.w3.org/2008/turtle#" }
43 };
44 private readonly Dictionary<string, ISemanticLiteral> dataTypes = new Dictionary<string, ISemanticLiteral>();
45 private readonly string text;
46 private readonly string blankNodeIdPrefix;
47 private readonly int len;
48 private readonly BlankNodeIdMode blankNodeIdMode;
49 private DateTimeOffset? date = null;
50 private Uri baseUri = null;
51 private int blankNodeIndex = 0;
52 private int pos = 0;
53
58 public TurtleDocument(string Text)
59 : this(Text, null)
60 {
61 }
62
68 public TurtleDocument(string Text, Uri BaseUri)
69 : this(Text, BaseUri, "n")
70 {
71 }
72
79 public TurtleDocument(string Text, Uri BaseUri, string BlankNodeIdPrefix)
80 : this(Text, BaseUri, BlankNodeIdPrefix, BlankNodeIdMode.Sequential)
81 {
82 }
83
91 public TurtleDocument(string Text, Uri BaseUri, string BlankNodeIdPrefix, BlankNodeIdMode BlankNodeIdMode)
92 {
93 this.text = Text;
94 this.len = this.text.Length;
95 this.baseUri = BaseUri;
96 this.blankNodeIdPrefix = BlankNodeIdPrefix;
97 this.blankNodeIdMode = BlankNodeIdMode;
98
99 if (!(this.baseUri is null))
100 this.namespaces[string.Empty] = this.baseUri.ToString();
101
102 this.ParseTriples();
103 }
104
108 public string Text => this.text;
109
113 public DateTimeOffset? Date => this.date;
114
115 private void ParseTriples()
116 {
117 this.ParseTriples(null);
118
119 if (this.pos < this.len)
120 throw this.ParsingException("Unexpected end of document.");
121 }
122
123 private void ParseTriples(ISemanticElement Subject)
124 {
125 ISemanticElement Predicate = null;
126 ISemanticElement Object;
127 int TriplePosition = Subject is null ? 0 : 1;
128 bool InBlankNode = !(Subject is null);
129
130 while (this.pos < this.len)
131 {
132 Object = this.ParseElement(TriplePosition,
133 out ChunkedList<ISemanticTriple> AdditionalTriples);
134
135 if (Object is null)
136 {
137 if (Subject is null)
138 return;
139 else if (Predicate is null)
140 {
141 if (InBlankNode)
142 return;
143 else
144 throw this.ParsingException("Expected predicate.");
145 }
146 else
147 throw this.ParsingException("Expected object.");
148 }
149
150 if (Subject is null)
151 {
152 Subject = Object;
153 TriplePosition++;
154
155 if (!(AdditionalTriples is null))
156 this.triples.AddRange(AdditionalTriples);
157 }
158 else if (Predicate is null)
159 {
160 Predicate = Object;
161 TriplePosition++;
162
163 if (!(AdditionalTriples is null))
164 this.triples.AddRange(AdditionalTriples);
165 }
166 else
167 {
168 this.Add(new SemanticTriple(Subject, Predicate, Object));
169 if (!(AdditionalTriples is null))
170 this.triples.AddRange(AdditionalTriples);
171
172 switch (this.NextNonWhitespaceChar())
173 {
174 case '.':
175 if (InBlankNode)
176 throw this.ParsingException("Expected ]");
177
178 Subject = null;
179 Predicate = null;
180 TriplePosition = 0;
181 break;
182
183 case ';':
184 Predicate = null;
185 TriplePosition = 1;
186
187 this.SkipWhiteSpace();
188 if (this.PeekNextChar() == '.')
189 {
190 if (InBlankNode)
191 throw this.ParsingException("Expected ]");
192
193 this.pos++;
194 Subject = null;
195 TriplePosition = 0;
196 }
197 break;
198
199 case ',':
200 break;
201
202 case ']':
203 case '|':
204 return;
205
206 default:
207 if (InBlankNode)
208 throw this.ParsingException("Expected triple delimiter ] ; or ,");
209 else
210 throw this.ParsingException("Expected triple delimiter . ; or ,");
211 }
212 }
213 }
214 }
215
220 public override void Add(ISemanticTriple Triple)
221 {
222 base.Add(Triple);
223
224 this.SkipWhiteSpace();
225 if (this.PeekNextChars(2) == "{|")
226 {
227 this.pos += 2;
228
229 if (!(Triple is SemanticTriple T))
230 T = new SemanticTriple(Triple.Subject, Triple.Predicate, Triple.Object);
231
232 this.ParseTriples(T);
233
234 this.SkipWhiteSpace();
235 if (this.NextChar() != '}')
236 throw this.ParsingException("Expected }");
237 }
238 }
239
240 private ISemanticElement ParseElement(int TriplePosition,
241 out ChunkedList<ISemanticTriple> AdditionalTriples)
242 {
243 AdditionalTriples = null;
244
245 while (true)
246 {
247 char ch = this.NextNonWhitespaceChar();
248
249 switch (ch)
250 {
251 case (char)0:
252 return null;
253
254 case '@':
255 string s = this.ParseName();
256
257 switch (s.ToLower())
258 {
259 case "base":
260 ch = this.NextNonWhitespaceChar();
261 if (ch != '<')
262 throw this.ParsingException("Expected <");
263
264 this.baseUri = this.ParseUri().Uri;
265
266 if (this.NextNonWhitespaceChar() != '.')
267 throw this.ParsingException("Expected .");
268
269 break;
270
271 case "prefix":
272 this.SkipWhiteSpace();
273
274 s = this.ParseName();
275
276 if (this.NextNonWhitespaceChar() != ':')
277 throw this.ParsingException("Expected :");
278
279 if (this.NextNonWhitespaceChar() != '<')
280 throw this.ParsingException("Expected <");
281
282 this.namespaces[s] = this.ParseUri().Uri.ToString();
283
284 if (this.NextNonWhitespaceChar() != '.')
285 throw this.ParsingException("Expected .");
286
287 break;
288
289 default:
290 throw this.ParsingException("Unrecognized keyword.");
291 }
292 break;
293
294 case '[':
295 switch (TriplePosition)
296 {
297 case 0:
298 BlankNode Node = this.CreateBlankNode();
299 this.ParseTriples(Node);
300
301 this.SkipWhiteSpace();
302 if (this.PeekNextChar() == '.')
303 {
304 this.pos++;
305 ISemanticElement Result = this.ParseElement(0, out AdditionalTriples);
306 if (!(AdditionalTriples is null))
307 this.triples.AddRange(AdditionalTriples);
308 return Result;
309 }
310
311 return Node;
312
313 case 1:
314 throw this.ParsingException("Predicate cannot be a blank node.");
315
316 case 2:
318 this.triples = AdditionalTriples = new ChunkedList<ISemanticTriple>();
319
320 Node = this.CreateBlankNode();
321 this.ParseTriples(Node);
322
323 this.triples = Bak;
324
325 return Node;
326
327 default:
328 throw this.ParsingException("Unrecognized triple position.");
329 }
330
331 case '(':
332 return this.ParseCollection(out AdditionalTriples);
333
334 case ']':
335 return null;
336
337 case '<':
338 if (this.PeekNextChar() == '<') // Quoted triples, part of RDF-star
339 {
340 this.pos++;
341
342 ISemanticElement Subject = this.ParseElement(0, out ChunkedList<ISemanticTriple> AdditionalTriples1);
343 ISemanticElement Predicate = this.ParseElement(1, out ChunkedList<ISemanticTriple> AdditionalTriples2);
344 ISemanticElement Object = this.ParseElement(2, out ChunkedList<ISemanticTriple> AdditionalTriples3);
345
346 if (this.NextNonWhitespaceChar() != '>')
347 throw this.ParsingException("Expected >");
348
349 if (this.NextNonWhitespaceChar() != '>')
350 throw this.ParsingException("Expected >");
351
352 if (!(AdditionalTriples1 is null))
353 this.triples.AddRange(AdditionalTriples1);
354
355 if (!(AdditionalTriples2 is null))
356 this.triples.AddRange(AdditionalTriples2);
357
358 if (!(AdditionalTriples3 is null))
359 this.triples.AddRange(AdditionalTriples3);
360
361 return new SemanticTriple(Subject, Predicate, Object);
362 }
363 else
364 return this.ParseUri();
365
366 case '"':
367 case '\'':
368 if (TriplePosition != 2)
369 throw this.ParsingException("Literals can only occur in object position.");
370
371 if (this.pos < this.len - 1 && this.text[this.pos] == ch && this.text[this.pos + 1] == ch)
372 {
373 this.pos += 2;
374 s = this.ParseString(ch, true, true);
375 }
376 else
377 s = this.ParseString(ch, false, true);
378
379 string Language = null;
380
381 if (this.pos < this.len && this.text[this.pos] == '@')
382 {
383 this.pos++;
384 Language = this.ParseName();
385 }
386
387 if (this.pos < this.len - 1 && this.text[this.pos] == '^' && this.text[this.pos + 1] == '^')
388 {
389 this.pos += 2;
390
391 string DataType = this.ParseUriOrPrefixedToken().Uri.ToString();
392
393 if (!this.dataTypes.TryGetValue(DataType, out ISemanticLiteral LiteralType))
394 {
395 LiteralType = Types.FindBest<ISemanticLiteral, string>(DataType)
396 ?? new CustomLiteral(string.Empty, DataType);
397
398 this.dataTypes[DataType] = LiteralType;
399 }
400
401 return LiteralType.Parse(s, DataType, Language);
402 }
403 else if (!string.IsNullOrEmpty(Language))
404 return new StringLiteral(s, Language);
405 else
406 return new StringLiteral(s);
407
408 case ':':
409 return this.ParsePrefixedToken(string.Empty);
410
411 default:
412 if (char.IsWhiteSpace(ch))
413 break;
414
415 if (ch == '_')
416 {
417 if (this.NextNonWhitespaceChar() != ':')
418 throw this.ParsingException("Expected :");
419
420 return new BlankNode(this.ParseName());
421 }
422 else if (char.IsLetter(ch) || ch == ':')
423 {
424 this.pos--;
425 s = this.ParseName();
426
427 if (this.PeekNextChar() == ':')
428 {
429 this.pos++;
430 return this.ParsePrefixedToken(s);
431 }
432
433 switch (s)
434 {
435 case "a":
436 if (TriplePosition == 1)
437 return RdfDocument.RdfType;
438 break;
439
440 case "true":
441 if (TriplePosition == 2)
442 return new BooleanLiteral(true);
443 break;
444
445 case "false":
446 if (TriplePosition == 2)
447 return new BooleanLiteral(false);
448 break;
449 }
450
451 throw this.ParsingException("Expected :");
452 }
453 else
454 {
455 if (TriplePosition != 2)
456 throw this.ParsingException("Literals can only occur in object position.");
457
458 this.pos--;
459 return this.ParseNumber();
460 }
461 }
462 }
463 }
464
465 private BlankNode CreateBlankNode()
466 {
467 if (this.blankNodeIdMode == BlankNodeIdMode.Guid)
468 return new BlankNode(this.blankNodeIdPrefix + Guid.NewGuid().ToString());
469 else
470 return new BlankNode(this.blankNodeIdPrefix + (++this.blankNodeIndex).ToString());
471 }
472
473 private ISemanticElement ParseCollection(out ChunkedList<ISemanticTriple> AdditionalTriples)
474 {
475 ChunkedList<ISemanticElement> Elements = null;
476 AdditionalTriples = null;
477
478 this.SkipWhiteSpace();
479
480 while (this.pos < this.len)
481 {
482 if (this.text[this.pos] == ')')
483 {
484 this.pos++;
485
486 if (Elements is null)
487 return RdfDocument.RdfNil;
488
490 BlankNode Result = this.CreateBlankNode();
491 BlankNode Current = Result;
492 int i, c;
493
494 while (!(Loop is null))
495 {
496 for (i = Loop.Start, c = Loop.Pos; i < c; i++)
497 {
498 this.Add(new SemanticTriple(Current, RdfDocument.RdfFirst, Loop[i]));
499
500 if (i < c - 1 || !(Loop.Next is null))
501 {
502 BlankNode Next = this.CreateBlankNode();
503 this.Add(new SemanticTriple(Current, RdfDocument.RdfRest, Next));
504 Current = Next;
505 }
506 }
507
508 Loop = Loop.Next;
509 }
510
512
513 return Result;
514 }
515
516 ISemanticElement Element = this.ParseElement(2,
517 out ChunkedList<ISemanticTriple> AdditionalTriples2);
518
519 if (!(AdditionalTriples2 is null))
520 {
521 if (AdditionalTriples is null)
522 AdditionalTriples = new ChunkedList<ISemanticTriple>();
523
524 AdditionalTriples.AddRange(AdditionalTriples2);
525 }
526
527 if (Element is null)
528 break;
529
530 if (Elements is null)
531 Elements = new ChunkedList<ISemanticElement>();
532
533 Elements.Add(Element);
534 this.SkipWhiteSpace();
535 }
536
537 throw this.ParsingException("Expected )");
538 }
539
540 private UriNode ParseUriOrPrefixedToken()
541 {
542 if (this.pos >= this.len)
543 throw this.ParsingException("Expected URI or prefixed token.");
544
545 if (this.text[this.pos] == '<')
546 {
547 this.pos++;
548 return this.ParseUri();
549 }
550
551 string Prefix = this.ParseName();
552
553 if (this.NextChar() != ':')
554 throw this.ParsingException("Expected :");
555
556 return this.ParsePrefixedToken(Prefix);
557 }
558
559 private UriNode ParsePrefixedToken(string Prefix)
560 {
561 if (!this.namespaces.TryGetValue(Prefix, out string Namespace))
562 throw this.ParsingException("Prefix unknown.");
563
564 this.SkipWhiteSpace();
565
566 string LocalName = this.ParseName();
567
568 return new UriNode(new Uri(Namespace + LocalName), Prefix + ":" + LocalName);
569 }
570
571 private string ParseName()
572 {
573 if (!IsNameStartChar(this.PeekNextChar()))
574 return string.Empty;
575
576 int Start = this.pos++;
577 bool LastPeriod = false;
578
579 while (IsNameChar(this.PeekNextChar(), ref LastPeriod))
580 this.pos++;
581
582 if (LastPeriod)
583 this.pos--;
584
585 return this.text.Substring(Start, this.pos - Start);
586 }
587
593 public static bool IsNameStartChar(char ch)
594 {
595 if (ch < 'A')
596 return false;
597 else if (ch <= 'Z')
598 return true;
599 else if (ch < '_')
600 return false;
601 else if (ch == '_')
602 return true;
603 else if (ch < 'a')
604 return false;
605 else if (ch <= 'z')
606 return true;
607 else if (ch < '\xc0')
608 return false;
609 else if (ch <= '\xd6')
610 return true;
611 else if (ch < '\xd8')
612 return false;
613 else if (ch <= '\xf6')
614 return true;
615 else if (ch < '\xf8')
616 return false;
617 else if (ch <= '\x02ff')
618 return true;
619 else if (ch < '\x0370')
620 return false;
621 else if (ch <= '\x037d')
622 return true;
623 else if (ch < '\x037f')
624 return false;
625 else if (ch <= '\x1fff')
626 return true;
627 else if (ch < '\x037f')
628 return false;
629 else if (ch <= '\x1fff')
630 return true;
631 else if (ch < '\x200c')
632 return false;
633 else if (ch <= '\x200d')
634 return true;
635 else if (ch < '\x2070')
636 return false;
637 else if (ch <= '\x218f')
638 return true;
639 else if (ch < '\x2C00')
640 return false;
641 else if (ch <= '\x2FEF')
642 return true;
643 else if (ch < '\x3001')
644 return false;
645 else if (ch <= '\xD7FF')
646 return true;
647 else if (ch < '\xF900')
648 return false;
649 else if (ch <= '\xFDCF')
650 return true;
651 else if (ch < '\xFDF0')
652 return false;
653 else if (ch <= '\xFFFD')
654 return true;
655 else
656 return false;
657 }
658
665 public static bool IsNameChar(char ch, ref bool LastPeriod)
666 {
667 if (IsNameStartChar(ch))
668 {
669 LastPeriod = false;
670 return true;
671 }
672 else if (ch < '-')
673 return false;
674 else if (ch == '-')
675 {
676 LastPeriod = false;
677 return true;
678 }
679 else if (ch == '.')
680 {
681 LastPeriod = true;
682 return true;
683 }
684 else if (ch < '0')
685 return false;
686 else if (ch <= '9')
687 {
688 LastPeriod = false;
689 return true;
690 }
691 else if (ch < '\x00B7')
692 return false;
693 else if (ch == '\x00B7')
694 {
695 LastPeriod = false;
696 return true;
697 }
698 else if (ch < '\x0300')
699 return false;
700 else if (ch <= '\x036F')
701 {
702 LastPeriod = false;
703 return true;
704 }
705 else if (ch < '\x203F')
706 return false;
707 else if (ch <= '\x2040')
708 {
709 LastPeriod = false;
710 return true;
711 }
712 else
713 return false;
714 }
715
716 private SemanticLiteral ParseNumber()
717 {
718 int Start = this.pos;
719 char ch = this.PeekNextChar();
720 bool HasDigits = false;
721 bool HasDecimal = false;
722 bool HasExponent = false;
723
724 if (ch == '+' || ch == '-')
725 {
726 this.pos++;
727 ch = this.PeekNextChar();
728 }
729
730 while (char.IsDigit(ch))
731 {
732 this.pos++;
733 ch = this.PeekNextChar();
734 HasDigits = true;
735 }
736
737 if (ch == '.')
738 {
739 HasDecimal = true;
740 this.pos++;
741 ch = this.PeekNextChar();
742
743 while (char.IsDigit(ch))
744 {
745 this.pos++;
746 ch = this.PeekNextChar();
747 }
748 }
749
750 if (ch == 'e' || ch == 'E')
751 {
752 HasExponent = true;
753 this.pos++;
754 ch = this.PeekNextChar();
755
756 if (ch == '+' || ch == '-')
757 {
758 this.pos++;
759 ch = this.PeekNextChar();
760 }
761
762 while (char.IsDigit(ch))
763 {
764 this.pos++;
765 ch = this.PeekNextChar();
766 }
767 }
768
769 if (this.pos > Start)
770 {
771 string s = this.text.Substring(Start, this.pos - Start);
772
773 if (HasExponent)
774 {
775 if (CommonTypes.TryParse(s, out double dbl))
776 return new DoubleLiteral(dbl, s);
777 else
778 throw this.ParsingException("Invalid double number.");
779 }
780 else if (HasDecimal)
781 {
782 if (CommonTypes.TryParse(s, out decimal dec))
783 return new DecimalLiteral(dec, s);
784 else
785 throw this.ParsingException("Invalid decimal number.");
786 }
787 else if (HasDigits)
788 {
789 if (BigInteger.TryParse(s, out BigInteger bi))
790 return new IntegerLiteral(bi, s);
791 else
792 throw this.ParsingException("Invalid integer number.");
793 }
794 }
795
796 throw this.ParsingException("Expected value element.");
797 }
798
799 private string ParseString(char EndChar, bool MultiLine, bool IncludeWhiteSpace)
800 {
801 StringBuilder sb = null;
802 int Start = this.pos;
803 char ch;
804
805 while ((ch = this.PeekNextChar()) != (char)0)
806 {
807 this.pos++;
808
809 if (ch == EndChar)
810 {
811 if (MultiLine)
812 {
813 if (this.pos < this.len - 1 && this.text[this.pos] == EndChar && this.text[this.pos + 1] == EndChar)
814 {
815 this.pos += 2;
816 return sb?.ToString() ?? this.text.Substring(Start, this.pos - Start - 3);
817 }
818 else
819 sb?.Append(ch);
820 }
821 else
822 return sb?.ToString() ?? this.text.Substring(Start, this.pos - Start - 1);
823 }
824 else if (ch == '\\')
825 {
826 if (sb is null)
827 {
828 sb = new StringBuilder();
829
830 if (this.pos > Start + 1)
831 sb.Append(this.text.Substring(Start, this.pos - Start - 1));
832 }
833
834 switch (ch = this.NextChar())
835 {
836 case (char)0:
837 throw this.ParsingException("Expected escape code.");
838
839 case 't':
840 sb.Append('\t');
841 break;
842
843 case 'n':
844 sb.Append('\n');
845 break;
846
847 case 'r':
848 sb.Append('\r');
849 break;
850
851 case 'v':
852 sb.Append('\v');
853 break;
854
855 case 'f':
856 sb.Append('\f');
857 break;
858
859 case 'b':
860 sb.Append('\b');
861 break;
862
863 case 'a':
864 sb.Append('\a');
865 break;
866
867 case 'u':
868 if (this.pos < this.len - 3 && int.TryParse(this.text.Substring(this.pos, 4), System.Globalization.NumberStyles.HexNumber, null, out int i))
869 {
870 sb.Append((char)i);
871 this.pos += 4;
872 }
873 else
874 throw this.ParsingException("Expected 4-character hexadecimal code.");
875 break;
876
877 case 'U':
878 if (this.pos < this.len - 7 && int.TryParse(this.text.Substring(this.pos, 8), System.Globalization.NumberStyles.HexNumber, null, out i))
879 {
880 sb.Append((char)i);
881 this.pos += 8;
882 }
883 else
884 throw this.ParsingException("Expected 8-character hexadecimal code.");
885 break;
886
887 default:
888 sb.Append(ch);
889 break;
890 }
891 }
892 else if (IncludeWhiteSpace || !char.IsWhiteSpace(ch))
893 sb?.Append(ch);
894 }
895
896 throw this.ParsingException("Expected " + new string(EndChar, MultiLine ? 3 : 1));
897 }
898
899 private ParsingException ParsingException(string Message)
900 {
901 return new ParsingException(Message, this.text, this.pos);
902 }
903
904 private UriNode ParseUri()
905 {
906 string Short = this.ParseString('>', false, false);
907
908 if (this.baseUri is null)
909 {
910 if (Uri.TryCreate(Short, UriKind.RelativeOrAbsolute, out Uri URI))
911 return new UriNode(URI, Short);
912 else
913 throw this.ParsingException("Invalid URI.");
914 }
915 else
916 {
917 if (string.IsNullOrEmpty(Short))
918 return new UriNode(this.baseUri, Short);
919 else if (Uri.TryCreate(this.baseUri, Short, out Uri URI))
920 return new UriNode(URI, Short);
921 else
922 throw this.ParsingException("Invalid URI.");
923 }
924 }
925
926 private void SkipLine()
927 {
928 char ch;
929
930 while ((ch = this.PeekNextChar()) != '\r' && ch != '\n' && ch != 0)
931 this.pos++;
932 }
933
934 private void SkipWhiteSpace()
935 {
936 char ch;
937
938 while (true)
939 {
940 ch = this.PeekNextChar();
941
942 if (char.IsWhiteSpace(ch))
943 this.pos++;
944 else if (ch == '#')
945 this.SkipLine();
946 else
947 break;
948 }
949 }
950
951 private char PeekNextChar()
952 {
953 if (this.pos < this.len)
954 return this.text[this.pos];
955 else
956 return (char)0;
957 }
958
959 private string PeekNextChars(int NrChars)
960 {
961 if (this.pos + NrChars <= this.len)
962 return this.text.Substring(this.pos, NrChars);
963 else
964 return string.Empty;
965 }
966
967 private char NextChar()
968 {
969 if (this.pos < this.len)
970 {
971 char ch = this.text[this.pos++];
972 while (ch == '#')
973 {
974 this.SkipLine();
975 if (this.pos < this.len)
976 ch = this.text[this.pos++];
977 else
978 return (char)0;
979 }
980
981 return ch;
982 }
983 else
984 return (char)0;
985 }
986
987 private char NextNonWhitespaceChar()
988 {
989 char ch;
990
991 do
992 {
993 ch = this.NextChar();
994 }
995 while (ch != 0 && char.IsWhiteSpace(ch));
996
997 return ch;
998 }
999
1004 public Task DecodeMetaInformation(HttpResponseMessage HttpResponse)
1005 {
1006 this.date = HttpResponse.Headers.Date;
1007 return Task.CompletedTask;
1008 }
1009 }
1010}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:15
static bool TryParse(string s, out double Value)
Tries to decode a string encoded double.
Definition: CommonTypes.cs:48
ChunkedList< ISemanticTriple > triples
Triples in model.
Represents a blank node
Definition: BlankNode.cs:7
Represents an integer literal of undefined size.
Abstract base class for semantic literal values.
Contains semantic information stored in an RDF document.
Definition: RdfDocument.cs:23
static UriNode RdfType
rdf:type predicate
Definition: RdfDocument.cs:27
static UriNode RdfNil
Predefined reference to end of collection.
Definition: RdfDocument.cs:42
static UriNode RdfRest
Predefined reference to next element in a collection.
Definition: RdfDocument.cs:37
static UriNode RdfFirst
Predefined reference to first element in a collection.
Definition: RdfDocument.cs:32
Contains semantic information stored in a turtle document. https://www.w3.org/TR/rdf12-turtle/ https:...
override void Add(ISemanticTriple Triple)
Adds a triple to the cube.
static bool IsNameChar(char ch, ref bool LastPeriod)
Checks if a character can be included in a name.
string Text
Original text of document.
TurtleDocument(string Text)
Contains semantic information stored in a turtle document.
Task DecodeMetaInformation(HttpResponseMessage HttpResponse)
Decodes meta-information available in the HTTP Response.
DateTimeOffset? Date
Server timestamp of document.
static bool IsNameStartChar(char ch)
Checks if a character is a character that can start a name.
TurtleDocument(string Text, Uri BaseUri, string BlankNodeIdPrefix)
Contains semantic information stored in a turtle document.
TurtleDocument(string Text, Uri BaseUri)
Contains semantic information stored in a turtle document.
TurtleDocument(string Text, Uri BaseUri, string BlankNodeIdPrefix, BlankNodeIdMode BlankNodeIdMode)
Contains semantic information stored in a turtle document.
Node referencing a chunk in a ChunkedList<T>
Definition: ChunkNode.cs:11
ChunkNode< T > Next
Next chunk
Definition: ChunkNode.cs:26
int Pos
Index after the last element in chunk.
Definition: ChunkNode.cs:51
int Start
Index of first element in chunk.
Definition: ChunkNode.cs:46
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
ChunkNode< T > FirstChunk
First chunk
Definition: ChunkedList.cs:259
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:15
Interface for content classes, that process information available in HTTP headers in the response.
Interface for semantic nodes.
Interface for semantic literals.
Interface for semantic triples.
ISemanticElement Object
Object element
ISemanticElement Predicate
Predicate element
ISemanticElement Subject
Subject element
BlankNodeIdMode
How blank node IDs are generated
delegate string ToString(IElement Element)
Delegate for callback methods that convert an element value to a string.
Prefix
SI prefixes. http://physics.nist.gov/cuu/Units/prefixes.html
Definition: Prefixes.cs:11