@@ -8485,10 +8485,92 @@ <h3>Graph Containers</h3>
8485
8485
8486
8486
< p > When processing a JSON-LD
8487
8487
< a data-cite ="HTML52/semantics-scripting.html#the-script-element "> script element</ a > ,
8488
- only the resolved document location of the
8489
- containing HTML document is used to establish the default < a > base IRI</ a > of the enclosed
8488
+ the < a data-cite ="HTML52/infrastructure.html#document-base-url "> Document Base URL</ a >
8489
+ of the containing HTML document,
8490
+ as defined in [[HTML52]],
8491
+ is used to establish the default < a > base IRI</ a > of the enclosed
8490
8492
JSON-LD content.</ p >
8491
8493
8494
+ < aside class ="example ds-selector-tabs "
8495
+ title ="Using the document base URL to establish the default base IRI ">
8496
+ < div class ="selectors ">
8497
+ < button class ="selected " data-selects ="original "> Original</ button >
8498
+ < button data-selects ="expanded "> Expanded</ button >
8499
+ < button data-selects ="statements "> Statements</ button >
8500
+ < button data-selects ="turtle "> Turtle</ button >
8501
+ </ div >
8502
+ < pre class ="original selected " data-transform ="updateExample "
8503
+ data-content-type ="text/html ">
8504
+ <!--
8505
+ ****<html>
8506
+ <head>
8507
+ <base href="http://dbpedia.org/resource/"/>****
8508
+ <script type="application/ld+json">
8509
+ < !--
8510
+ {
8511
+ "@context": "https://json-ld.org/contexts/person.jsonld",
8512
+ "@id": ****"John_Lennon"****,
8513
+ "name": "John Lennon",
8514
+ "born": "1940-10-09",
8515
+ "spouse": ****"Cynthia_Lennon"****
8516
+ }
8517
+ -- >
8518
+ </script>
8519
+ ****</head>
8520
+ </html>****
8521
+ -->
8522
+ </ pre >
8523
+ < pre class ="expanded "
8524
+ data-transform ="updateExample "
8525
+ data-result-for ="Using the document base URL to establish the default base IRI-original ">
8526
+ <!--
8527
+ [{
8528
+ "@id": "http://dbpedia.org/resource/John_Lennon",
8529
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
8530
+ "http://schema.org/birthDate": [
8531
+ {"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
8532
+ ],
8533
+ "http://schema.org/spouse": [
8534
+ {"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
8535
+ ]
8536
+ }]
8537
+ -->
8538
+ </ pre >
8539
+ < table class ="statements "
8540
+ data-result-for ="Using the document base URL to establish the default base IRI-expanded "
8541
+ data-to-rdf >
8542
+ < thead > < tr > < th > Subject</ th > < th > Property</ th > < th > Value</ th > < th > Value Type</ th > </ tr > </ thead >
8543
+ < tbody >
8544
+ < tr > < td > http://dbpedia.org/resource/John_Lennon</ td > < td > foaf:name</ td > < td > John Lennon</ td > < td > </ td > </ tr >
8545
+ < tr > < td > http://dbpedia.org/resource/John_Lennon</ td > < td > schema:birthDate</ td > < td > 1940-10-09</ td > < td > xsd:date</ td > </ tr >
8546
+ < tr > < td > http://dbpedia.org/resource/John_Lennon</ td > < td > schema:spouse</ td > < td > http://dbpedia.org/resource/Cynthia_Lennon</ td > < td > </ td > </ tr >
8547
+ </ tbody >
8548
+ </ table >
8549
+ < pre class ="turtle "
8550
+ data-content-type ="text/turtle "
8551
+ data-transform ="updateExample "
8552
+ data-result-for ="Using the document base URL to establish the default base IRI-expanded "
8553
+ data-to-rdf >
8554
+ <!--
8555
+ @base <http://dbpedia.org/resource/> .
8556
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
8557
+ @prefix schema: <http://schema.org/> .
8558
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
8559
+
8560
+ <John_Lennon> foaf:name "John Lennon";
8561
+ schema:birthDate "1940-10-09"^^xsd:date;
8562
+ schema:spouse <Cynthia_Lennon> .
8563
+ -->
8564
+ </ pre >
8565
+ </ aside >
8566
+
8567
+ < p > HTML allows for < a data-cite ="HTML52/infrastructure.html#dynamic-changes-to-base-urls "> Dynamic changes to base URLs</ a > .
8568
+ This specification does not require any specific behavior,
8569
+ and to ensure that all systems process the < a > base IRI</ a > equivalently, authors SHOULD
8570
+ either use < a > absolute IRIs</ a > , or explicitly as defined in < a href ="#base-iri " class ="sectionRef "> </ a > .
8571
+ Implementations (particularly those natively operating in the [[!DOM]]) MAY take into consideration
8572
+ < a data-cite ="HTML52/infrastructure.html#dynamic-changes-to-base-urls "> Dynamic changes to base URLs</ a > .</ p >
8573
+
8492
8574
< section > < h3 > Restrictions for contents of JSON-LD < code > script</ code > elements</ h3 >
8493
8575
8494
8576
< p > Depending on how the HTML document is served, certain strings may need
0 commit comments