jobdataexchange / Data-Modeling

This repo is intended to contain resources and discussion regarding the JDX data modeling.
Other
8 stars 6 forks source link

Embedding HTML tags in literals #24

Open stuartasutton opened 5 years ago

stuartasutton commented 5 years ago

At least one property (jdx:formattedDescription) must accommodate HTML tagging. This can be accomplished by using the rdf:HTML datatype; e.g.:

Turtle

@prefix jdx: <http://purl.org/jdx/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/1234> a jdx:JobPosting;
    jdx:formattedDescription "<li><strong>Excellent typing skills required</strong></li>"^^rdf:HTML .

JSON-LD

{
  "@context": {
    "jdx": "http://purl.org/jdx/terms/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "@id": "http://example.org/1234",
  "@type": "jdx:JobPosting",
  "jdx:formattedDescription": {
    "@type": "rdf:HTML",
    "@value": "<li><strong>Excellent typing skills required</strong></li>"
  }
}
DMSaunders commented 4 years ago

Why not replace schema:description with jdx:formattedDescription? Since linebreaks are needed at a minimum, any descriptions pasted into this field could have linebreaks encoded and stored in jdx:formattedDescription, which would make it minimally compatible with Google.