Skip to content

Commit

Permalink
Clean up contexts in profiles.clj
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasl committed Apr 5, 2012
1 parent ecbaafc commit 67b26b4
Showing 1 changed file with 68 additions and 70 deletions.
138 changes: 68 additions & 70 deletions src/rdfa/profiles.clj
Expand Up @@ -10,81 +10,79 @@
(def xsd:gYear (str xsd "gYear"))
(def xsd:gYearMonth (str xsd "gYearMonth")))

(def contexts
{:xml ; "http://www.w3.org/2011/rdfa-context/rdfa-1.1"
{:prefix-map {"grddl" "http://www.w3.org/2003/g/data-view#",
"ma" "http://www.w3.org/ns/ma-ont#"
"owl" "http://www.w3.org/2002/07/owl#",
"rdf" "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfa" "http://www.w3.org/ns/rdfa#",
"rdfs" "http://www.w3.org/2000/01/rdf-schema#",
"rif" "http://www.w3.org/2007/rif#",
"skos" "http://www.w3.org/2004/02/skos/core#",
"skosxl" "http://www.w3.org/2008/05/skos-xl#",
"wdr" "http://www.w3.org/2007/05/powder#",
"void" "http://rdfs.org/ns/void#",
"wdrs" "http://www.w3.org/2007/05/powder-s#",
"xhv" "http://www.w3.org/1999/xhtml/vocab#",
"xml" "http://www.w3.org/XML/1998/namespace",
"xsd" "http://www.w3.org/2001/XMLSchema#",
"cc" "http://creativecommons.org/ns#",
"ctag" "http://commontag.org/ns#",
"dc" "http://purl.org/dc/terms/",
"dcterms" "http://purl.org/dc/terms/",
"foaf" "http://xmlns.com/foaf/0.1/",
"gr" "http://purl.org/goodrelations/v1#",
"ical" "http://www.w3.org/2002/12/cal/icaltzd#",
"og" "http://ogp.me/ns#",
"rev" "http://purl.org/stuff/rev#",
"sioc" "http://rdfs.org/sioc/ns#",
"v" "http://rdf.data-vocabulary.org/#",
"vcard" "http://www.w3.org/2006/vcard/ns#",
"schema" "http://schema.org/"}
:term-map {"describedby" "http://www.w3.org/2007/05/powder-s#describedby",
"license" "http://www.w3.org/1999/xhtml/vocab#license",
"role" "http://www.w3.org/1999/xhtml/vocab#role"}
:vocab nil}
:xhtml ; "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"
{:prefix-map {}
:term-map {"alternate" "http://www.w3.org/1999/xhtml/vocab#alternate",
"appendix" "http://www.w3.org/1999/xhtml/vocab#appendix",
"cite" "http://www.w3.org/1999/xhtml/vocab#cite",
"bookmark" "http://www.w3.org/1999/xhtml/vocab#bookmark",
"contents" "http://www.w3.org/1999/xhtml/vocab#contents",
"chapter" "http://www.w3.org/1999/xhtml/vocab#chapter",
"copyright" "http://www.w3.org/1999/xhtml/vocab#copyright",
"first" "http://www.w3.org/1999/xhtml/vocab#first",
"glossary" "http://www.w3.org/1999/xhtml/vocab#glossary",
"help" "http://www.w3.org/1999/xhtml/vocab#help",
"icon" "http://www.w3.org/1999/xhtml/vocab#icon",
"index" "http://www.w3.org/1999/xhtml/vocab#index",
"last" "http://www.w3.org/1999/xhtml/vocab#last",
"license" "http://www.w3.org/1999/xhtml/vocab#license",
"meta" "http://www.w3.org/1999/xhtml/vocab#meta",
"next" "http://www.w3.org/1999/xhtml/vocab#next",
"prev" "http://www.w3.org/1999/xhtml/vocab#prev",
"previous" "http://www.w3.org/1999/xhtml/vocab#previous",
"section" "http://www.w3.org/1999/xhtml/vocab#section",
"start" "http://www.w3.org/1999/xhtml/vocab#start",
"stylesheet" "http://www.w3.org/1999/xhtml/vocab#stylesheet",
"subsection" "http://www.w3.org/1999/xhtml/vocab#subsection",
"top" "http://www.w3.org/1999/xhtml/vocab#top",
"up" "http://www.w3.org/1999/xhtml/vocab#up",
"p3pv1" "http://www.w3.org/1999/xhtml/vocab#p3pv1"}
:vocab nil}})

; TODO: combine contexts properly!
(def xml-context
{:iri "http://www.w3.org/2011/rdfa-context/rdfa-1.1"
:prefix-map {"grddl" "http://www.w3.org/2003/g/data-view#",
"ma" "http://www.w3.org/ns/ma-ont#"
"owl" "http://www.w3.org/2002/07/owl#",
"rdf" "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfa" "http://www.w3.org/ns/rdfa#",
"rdfs" "http://www.w3.org/2000/01/rdf-schema#",
"rif" "http://www.w3.org/2007/rif#",
"skos" "http://www.w3.org/2004/02/skos/core#",
"skosxl" "http://www.w3.org/2008/05/skos-xl#",
"wdr" "http://www.w3.org/2007/05/powder#",
"void" "http://rdfs.org/ns/void#",
"wdrs" "http://www.w3.org/2007/05/powder-s#",
"xhv" "http://www.w3.org/1999/xhtml/vocab#",
"xml" "http://www.w3.org/XML/1998/namespace",
"xsd" "http://www.w3.org/2001/XMLSchema#",
"cc" "http://creativecommons.org/ns#",
"ctag" "http://commontag.org/ns#",
"dc" "http://purl.org/dc/terms/",
"dcterms" "http://purl.org/dc/terms/",
"foaf" "http://xmlns.com/foaf/0.1/",
"gr" "http://purl.org/goodrelations/v1#",
"ical" "http://www.w3.org/2002/12/cal/icaltzd#",
"og" "http://ogp.me/ns#",
"rev" "http://purl.org/stuff/rev#",
"sioc" "http://rdfs.org/sioc/ns#",
"v" "http://rdf.data-vocabulary.org/#",
"vcard" "http://www.w3.org/2006/vcard/ns#",
"schema" "http://schema.org/"}
:term-map {"describedby" "http://www.w3.org/2007/05/powder-s#describedby",
"license" "http://www.w3.org/1999/xhtml/vocab#license",
"role" "http://www.w3.org/1999/xhtml/vocab#role"}
:vocab nil})

(def contexts
(assoc-in contexts [:xhtml :prefix-map]
(get-in contexts [:xml :prefix-map])))
(def xhtml-context
{:iri "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"
:prefix-map (:prefix-map xml-context)
:term-map (merge
(:term-map xml-context)
{"alternate" "http://www.w3.org/1999/xhtml/vocab#alternate",
"appendix" "http://www.w3.org/1999/xhtml/vocab#appendix",
"cite" "http://www.w3.org/1999/xhtml/vocab#cite",
"bookmark" "http://www.w3.org/1999/xhtml/vocab#bookmark",
"contents" "http://www.w3.org/1999/xhtml/vocab#contents",
"chapter" "http://www.w3.org/1999/xhtml/vocab#chapter",
"copyright" "http://www.w3.org/1999/xhtml/vocab#copyright",
"first" "http://www.w3.org/1999/xhtml/vocab#first",
"glossary" "http://www.w3.org/1999/xhtml/vocab#glossary",
"help" "http://www.w3.org/1999/xhtml/vocab#help",
"icon" "http://www.w3.org/1999/xhtml/vocab#icon",
"index" "http://www.w3.org/1999/xhtml/vocab#index",
"last" "http://www.w3.org/1999/xhtml/vocab#last",
"license" "http://www.w3.org/1999/xhtml/vocab#license",
"meta" "http://www.w3.org/1999/xhtml/vocab#meta",
"next" "http://www.w3.org/1999/xhtml/vocab#next",
"prev" "http://www.w3.org/1999/xhtml/vocab#prev",
"previous" "http://www.w3.org/1999/xhtml/vocab#previous",
"section" "http://www.w3.org/1999/xhtml/vocab#section",
"start" "http://www.w3.org/1999/xhtml/vocab#start",
"stylesheet" "http://www.w3.org/1999/xhtml/vocab#stylesheet",
"subsection" "http://www.w3.org/1999/xhtml/vocab#subsection",
"top" "http://www.w3.org/1999/xhtml/vocab#top",
"up" "http://www.w3.org/1999/xhtml/vocab#up",
"p3pv1" "http://www.w3.org/1999/xhtml/vocab#p3pv1"})
:vocab nil})

(def contexts
(update-in contexts [:xhtml :term-map]
#(merge %1 (get-in contexts [:xml :term-map]))))

{:xml xml-context
:xhtml xhtml-context
:html xhtml-context})

(def contexts (assoc contexts :html (contexts :xhtml)))

(defn detect-host-language [&{:keys [location mime-type doctype xmlns]}]
; TODO: add support for the other options
Expand Down

0 comments on commit 67b26b4

Please sign in to comment.