Skip to content

Instantly share code, notes, and snippets.

@westurner
Last active December 17, 2015 23:04
Show Gist options
  • Save westurner/8c8b1cc12e2deeeba24d to your computer and use it in GitHub Desktop.
Save westurner/8c8b1cc12e2deeeba24d to your computer and use it in GitHub Desktop.
# :*_markdown_github[__html]
# :*_markdown_commonmark[__html]
# Markdown[HTML] > MarkdownGithub[HTML]
# Markdown[HTML] > MarkdownCommonmark[HTML]
rdfx:Markdown a rdfs:Datatype ;
.
rdfx:MarkdownGithub a rdfs:Datatype ;
.
rdfx:MarkdownCommonMark a rdfs:Datatype ;
.
rdfx:MarkdownHTML
a rdfs:Datatype ;
rdfs:label "MarkdownHTML"@en ;
rdfs:comment "Markdown -> HTML"@en ;
.
rdfx:MarkdownCommonMarkHTML # this [would not require] RDFS/OWL expansion
a rdfs:Datatype;
rdfx:syntax rdfx:CommonMark ; # this [would require] RDFS/OWL expansion
rdfs:subClassOf rdf:MarkdownHTML ; # this [would require] RDF/OWL expansion
.
rdfx:description_markdown_github
a rdf:Property ;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
xsd:string
schema:Text
sysont:Markdown
rdfx:Markdown
) ;
] ;
.
## simple solution that works today:
# e.g. for schema:description
# ex:description_markdown_github
# ex:description_markdown_github__html
# ex:description_markdown_commonmark
# ex:description_markdown_commonmark__html
ex:description_markdown
a rdf:Property ;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
xsd:string
schema:Text
sysont:Markdown
rdfx:Markdown
) ;
] ;
ex:description_markdown_github
a rdf:Property ;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
xsd:string
schema:Text
sysont:Markdown
rdfx:Markdown
) ;
] ;
.
ex:description_markdown_commonmark
a rdf:Property ;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
xsd:string
schema:Text
sysont:Markdown
rdfx:Markdown
) ;
] ;
.
ex:description_markdown__html
a rdf:Property;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
rdf:HTML
rdfx:MarkdownHTML
) ;
] ;
.
ex:description_markdown_commonmark__html
a rdf:Property;
rdfs:range [
rdf:type owl:Class ;
owl:unionOf (
rdf:HTML
rdfx:MarkdownHTML
rdfx:MarkdownCommonmarkHTML
) ;
] ;
.
#
:thing1 a schema:Thing ;
rdfx:markdown "# example";
rdfx:markdown__html "<h1>example</h1>";
schemax:description_markdown "# example";
schemax:description_markdown__html "<h1>example</h1>";
.
:thing2_commonmark a schema:Thing ;
rdfx:markdown " # example" ;
rdfx:markdown__html "<h1>example</h1>"^^rdfx:MarkdownCommonmarkHTML ;
schemax:description_markdown "# example"^^rdfx:MarkdownCommonMark ;
schemax:description_markdown__html "<h1>example</h1>"^^rdfx:MarkdownCommonMarkHTML ;
.
:thing3_commonmark a schema:Thing ;"# example"^^rdfx:MarkdownCommonmark ;
schemax:description_en_markdown "# example"^^rdfx:MarkdownCommonMark ;
schemax:description_en_markdown__html "<h1>example</h1>"^^rdfx:MarkdownCommonMarkHTML ;
# according to https://jena.apache.org/documentation/notes/typed-literals.html ,
# we can't use xml:Lang with typed literals, so e.g. the following is not
# technically valid::
#
# @en^^rdfx:MarkdownCommonmark is not spec'd
# if this was valid, we could pseudo-key on xml:Lang
# so it would be
# schemax:description_markdown "..."@en^^rdfx:MarkdownCommonMark ;
# rather than
# schemax:description_markdown "..."@en-us ;
# schemax:description_markdown "..."@en-gb ;
# # or #
# schemax:description_markdown_en "..."^^rdfx:MarkdownCommonMark ;
# schemax:description_markdown_en-gb "..."^^rdfx:MarkdownCommonMark ;
#
@westurner
Copy link
Author

according to https://jena.apache.org/documentation/notes/typed-literals.html ,
we can't use xml:Lang with typed literals [...]

@westurner
Copy link
Author

How can we enumerate Lighweight Markup Languages with URIs?

ASCII collation?

  • rdfx: rdfs:labels:
    • BBCode
    • CommonMark
    • Markdown
    • MarkdownCommonMark
    • MarkdownGithub
    • MediaWikiMarkup
    • ReStructuredText
    • Textile
    • ...

Could/should these [also/instead] be lowercase for use as datatypes? e.g. xsd:string, xsd:integer

  • thisisonelongword --
  • CamelCase -- rdfs:Class
  • under_scores -- [python] variables, member_variables, function_names

@westurner
Copy link
Author

Why the __ in __html?

description_markdown = "# h1"

description_markdown__html   # description_markdown__html isDerivedFrom description_markdown

description__markdown__html  # markdown is not computed from description
                             # but, this could show that, both:
                             #   description__markdown__html isDerivedFrom description__markdown
                             #   description__markdown isInsteadOfAlso description


description_markdownhtml
description__MarkdownHTML
descriptionMarkdownHTML      # this is the traditional RDFS/OWL Property camelCasing
                             # downstream variables are then named accordingly
                             # 
                             # so, in Python (with PEP 8)::
                             #
                             #   description_markdown_html = descriptionMarkdownHTML
                             #
                             # and then in JSON / JSON-LD::
                             #
                             #  { "name": "one",
                             #    "description__markdown": "# h1",
                             #    "description__markdown__html": "<h1>h1</h1>",
                             #   },
                             #  { "name": "one",
                             #    "descriptionMarkdown": "# h1",
                             #    "descriptionMarkdownHTML": "<h1>h1</h1>",
                             #   }

@westurner
Copy link
Author

attr, fmt = key.split('__', -1) if key.startswith('description_')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment