2

I am making a tool to render a program into SVG representation of the program. I would like to store input source code into SVG so that it can be reproduced if necessary. The source code is in JSON (it is a domain specific language).

I am currently setting <metadata> for the SVG to:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/">
  <schema:SoftwareSourceCode">
    <schema:text>{...}</schema:text>
  </schema:SoftwareSourceCode>
</rdf:RDF>

Is this a correct way to embed source code into SVG <metadata>? Is some other schema, entity, or property a better choice?

What I do not know how to do is how to set rdf:datatype for schema:text to inform the reader that contents are JSON?

Mitar
  • 6,756
  • 5
  • 54
  • 86
  • also: define your `CURIE`s and reuse on SVG statements. See examples on: http://rhizomik.net/html/redefer/rdf2svg-form/ – Jay Gray Jun 23 '19 at 19:25
  • @JayGray can you elaborate? I am not familiar with what you are suggesting. – Mitar Jun 24 '19 at 00:06
  • Take a look at the SVG code generated by Adobe `Illustrator` or Microsoft `Visio`. Each will define a vocabulary, set the `CURIE` for the vocabulary `namespace`, and then reuse the `CURIE` on SVG `` statements. Those SVG documents can be harvested (parsed and processed) by - for example - an RDFa reader. – Jay Gray Jun 24 '19 at 05:47
  • There exists the [`schema:programmingLanguage`](https://schema.org/programmingLanguage) property. Similar question: https://opendata.stackexchange.com/q/3981/16193 – Stanislav Kralin Jun 24 '19 at 06:33
  • Yes, i am using programming language to specify its name. But I would also like to convey that it is encoded as JSON. – Mitar Jun 24 '19 at 07:58

0 Answers0