@@ -1078,71 +1078,6 @@ <h3>application/ld+yaml</h3>
1078
1078
</ section >
1079
1079
</ section >
1080
1080
1081
- < section id ="faq " class ="informative " data-format ="markdown ">
1082
- < p class ="ednote "> REMOVE THIS SECTION BEFORE PUBLICATION.</ p >
1083
-
1084
- < h3 > FAQ</ h3 >
1085
-
1086
- #### Why does YAML-LD not extend the JSON-LD data model ?
1087
-
1088
- < div class ="ednote ">
1089
- [[JSON]] only represents simple trees while [[YAML]] can support
1090
- rooted, directed graphs with references and cycles.
1091
-
1092
- The above structures cannot be preserved when serializing
1093
- to JSON-LD and - with respect to cycles - the serialization
1094
- will fail.
1095
-
1096
- Programming languages such as Java and Python already support
1097
- < a > YAML representation graphs</ a > , but these implementations may behave
1098
- differently.
1099
- In the following example, `&value` references the value
1100
- of the keyword `value`.
1101
-
1102
- < pre class ="example yaml "
1103
- data-transform ="updateExample "
1104
- data-content-type ="application/ld+yaml "
1105
- title ="YAML-LD with references ">
1106
- <!--
1107
- value: &value 100
1108
- valve1:
1109
- temperature: &temp100C
1110
- value: *value
1111
- unit: degC
1112
- valve2:
1113
- temperature: *temp100C
1114
- -->
1115
- </ pre >
1116
-
1117
- Processing this entry in Python, I get the following
1118
- structure that preserve the references to
1119
- mutable objects (e.g., the `temperature` dict)
1120
- but not to scalars (e.g., the `value` keyword).
1121
-
1122
- < pre class ="example python "
1123
- data-transform ="updateExample "
1124
- data-result-for ="YAML-LD with references "
1125
- data-content-type ="text/x-python "
1126
- title ="Result of parsing YAML-LD with references to Python ">
1127
- <!--
1128
- temperature = { "value": 100, "unit": "degC" }
1129
- document = {
1130
- "value": 100,
1131
- "valve1": { "temperature": temperature },
1132
- "valve2": { "temperature": temperature }
1133
- }
1134
- -->
1135
- </ pre >
1136
-
1137
- Since all these implementations pre-date this
1138
- specification, some more interoperable choices include the following:
1139
-
1140
- * forbidding cycles in < a > YAML-LD documents</ a >
1141
- * considering all references in YAML-LD as static,
1142
- i.e., a shorthand way to repeat specific patterns
1143
-
1144
- </ div >
1145
- </ section >
1146
1081
< section id ="best-practices " class ="informative ">
1147
1082
< h2 > Best Practices</ h2 >
1148
1083
0 commit comments