rdfa-streaming-parser.js icon indicating copy to clipboard operation
rdfa-streaming-parser.js copied to clipboard

Literals that are the concatination of all descendant text nodes

Open brechtvdv opened this issue 2 years ago • 4 comments

For the case of Local Decisions as Linked Open Data (LBLOD), municipalities publish the content of their decisions using deeper nested Articles as follows:

<div prefix="eli: http://data.europa.eu/eli/ontology# foaf: http://xmlns.com/foaf/0.1/ besluit: http://data.vlaanderen.be/ns/besluit# prov: http://www.w3.org/ns/prov#" resource="http://data.lblod.info/id/besluiten/72b89f05-7398-4c12-890c-a130decac4f8" typeof="besluit:Besluit">
  <h5>Beslissing</h5>
  <div property="prov:value" datatype="xsd:string">
    <div property="eli:has_part" resource="http://data.lblod.info/artikels/f3366b82-3751-4333-8531-b9b58b6ccb7f" typeof="besluit:Artikel">
      <div property="eli:number" datatype="xsd:string">Artikel 1</div>
      <div property="prov:value" datatype="xsd:string">
        Goedkeuring werd verleend aan...
      </div>
    </div>
    <br>
    <br>
  </div>
</div>

Using the RDFa playground, this returns following triple:

<http://data.lblod.info/id/besluiten/72b89f05-7398-4c12-890c-a130decac4f8>
   <http://www.w3.org/ns/prov#value> "
    
      Artikel 1
      
        Goedkeuring werd verleend aan...
      
    
    
    
  "^^xsd:string;

However, with RDF play, I receive this triple:

<http://data.lblod.info/id/besluiten/72b89f05-7398-4c12-890c-a130decac4f8> <http://www.w3.org/ns/prov#value> "\n      \n        \n        \n      \n      \n      \n    "

According to the RDFa spec (step 11), this should be the concatination of the values of all descendant text nodes.

brechtvdv avatar Sep 28 '23 15:09 brechtvdv

Something is probably going wrong due to the nested RDFa tags inside the prov:value tag.

rubensworks avatar Oct 09 '23 06:10 rubensworks

@rubensworks but this is specifically allowed by the rdfa spec right? if you could hint at a possible solution we might be able to help out.

nvdk avatar Nov 16 '23 09:11 nvdk

Yep, I also think the spec allows this. Probably a bug somewhere here: https://github.com/rubensworks/rdfa-streaming-parser.js/blob/master/lib/RdfaParser.ts#L579-L593

rubensworks avatar Nov 21 '23 14:11 rubensworks

Could you check with v3.0.1? This may have been fixed as well thanks to https://github.com/rubensworks/rdfa-streaming-parser.js/commit/864a748dbc95d92991fed692aa2f7286e979740a

rubensworks avatar Apr 15 '25 14:04 rubensworks