001/* 002 * (c) Copyright 2009 University of Bristol 003 * All rights reserved. 004 * [See end of file] 005 */ 006package net.rootdev.javardfa; 007 008import java.util.Arrays; 009import java.util.Collection; 010import java.util.Collections; 011import java.util.HashMap; 012import java.util.HashSet; 013import java.util.List; 014import java.util.Map; 015import java.util.Set; 016import javax.xml.namespace.QName; 017 018/** 019 * 020 * @author pldms 021 */ 022public class Constants { 023 final static List<String> _allowed = Arrays.asList( 024 "alternate", "appendix", "bookmark", "cite", 025 "chapter", "contents", "copyright", "first", 026 "glossary", "help", "icon", "index", "last", 027 "license", "meta", "next", "p3pv1", "prev", 028 "collection", "role", "section", "stylesheet", 029 "subsection", "start", "top", "up"); 030 public final static Set<String> SpecialRels = new HashSet<String>(_allowed); 031 public final static String xhtmlNS = "http://www.w3.org/1999/xhtml"; 032 // Suggestion: switch this for object produced by factory that matches QNames 033 // we can then en-slacken if needed by passing in different factory etc 034 public final static QName about = new QName("about"); // safe 035 public final static QName resource = new QName("resource"); // safe 036 public final static QName href = new QName("href"); // URI 037 public final static QName src = new QName("src"); // URI 038 public final static QName property = new QName("property"); // CURIE 039 public final static QName datatype = new QName("datatype"); // CURIE 040 public final static QName typeof = new QName("typeof"); // CURIE 041 public final static QName rel = new QName("rel"); // Link types and CURIES 042 public final static QName rev = new QName("rev"); // Link type and CURIES 043 public final static QName content = new QName("content"); 044 public final static QName xmllang = new QName("xml:lang"); 045 public final static QName xmlbase = new QName("xml:base"); 046 public final static QName xmlbaseNS = new QName("http://www.w3.org/XML/1998/namespace", "base", "xml"); 047 public final static QName xmllangNS = new QName("http://www.w3.org/XML/1998/namespace", "lang", "xml"); 048 public final static QName lang = new QName("lang"); 049 public final static QName base = new QName("http://www.w3.org/1999/xhtml", "base"); 050 public final static QName head = new QName("http://www.w3.org/1999/xhtml", "head"); 051 public final static QName body = new QName("http://www.w3.org/1999/xhtml", "body"); 052 // Hack bits 053 public final static QName input = new QName("http://www.w3.org/1999/xhtml", "input"); 054 public final static QName name = new QName("name"); 055 public final static QName form = new QName("http://www.w3.org/1999/xhtml", "form"); 056 057 public final static Collection<String> rdfType = Collections.singleton("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); 058 public final static Collection<String> rdfaUses = Collections.singleton("http://www.w3.org/ns/rdfa#usesVocabulary"); 059 060 // RDFa 1.1 061 public final static QName vocab = new QName("vocab"); 062 public final static QName profile = new QName("profile"); 063 public final static QName prefix = new QName("prefix"); 064 065 private static Map<String, String> newMap(String... keyVals) { 066 Map<String, String> map = new HashMap<String, String>(); 067 for (int i = 0; i < keyVals.length; i += 2) { 068 map.put(keyVals[i], keyVals[i + 1]); 069 } 070 return map; 071 } 072 073 public final static Map<String, String> CORE_DEFAULT_PREFIXES = 074 newMap( 075 "xhv" , "http://www.w3.org/1999/xhtml/vocab#" , 076 "xml" , "http://www.w3.org/XML/1998/namespace" , 077 "rdf" , "http://www.w3.org/1999/02/22-rdf-syntax-ns#" , 078 "cc" , "http://creativecommons.org/ns#" , 079 "foaf" , "http://xmlns.com/foaf/0.1/" , 080 "rdfs" , "http://www.w3.org/2000/01/rdf-schema#" , 081 "gr" , "http://purl.org/goodrelations/v1#" , 082 "skosxl" , "http://www.w3.org/2008/05/skos-xl#" , 083 "dc" , "http://purl.org/dc/terms/" , 084 "vcard" , "http://www.w3.org/2006/vcard/ns#" , 085 "rif" , "http://www.w3.org/2007/rif#" , 086 "owl" , "http://www.w3.org/2002/07/owl#" , 087 "dcterms" , "http://purl.org/dc/terms/" , 088 "void" , "http://rdfs.org/ns/void#" , 089 "v" , "http://rdf.data-vocabulary.org/#" , 090 "xsd" , "http://www.w3.org/2001/XMLSchema#" , 091 "wdrs" , "http://www.w3.org/2007/05/powder-s#" , 092 "ma" , "http://www.w3.org/ns/ma-ont#" , 093 "schema" , "http://schema.org/" , 094 "rdfa" , "http://www.w3.org/ns/rdfa#" , 095 "wdr" , "http://www.w3.org/2007/05/powder#" , 096 "ctag" , "http://commontag.org/ns#" , 097 "rev" , "http://purl.org/stuff/rev#" , 098 "ical" , "http://www.w3.org/2002/12/cal/icaltzd#" , 099 "skos" , "http://www.w3.org/2004/02/skos/core#" , 100 "og" , "http://ogp.me/ns#" , 101 "sioc" , "http://rdfs.org/sioc/ns#" , 102 "grddl" , "http://www.w3.org/2003/g/data-view#" , 103 "describedby:" , "http://www.w3.org/2007/05/powder-s#describedby", 104 "license:", "http://www.w3.org/1999/xhtml/vocab#license", 105 "role:", "http://www.w3.org/1999/xhtml/vocab#role" 106 ); 107} 108 109/* 110 * (c) Copyright 2009 University of Bristol 111 * All rights reserved. 112 * 113 * Redistribution and use in source and binary forms, with or without 114 * modification, are permitted provided that the following conditions 115 * are met: 116 * 1. Redistributions of source code must retain the above copyright 117 * notice, this list of conditions and the following disclaimer. 118 * 2. Redistributions in binary form must reproduce the above copyright 119 * notice, this list of conditions and the following disclaimer in the 120 * documentation and/or other materials provided with the distribution. 121 * 3. The name of the author may not be used to endorse or promote products 122 * derived from this software without specific prior written permission. 123 * 124 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 125 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 126 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 127 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 128 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 129 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 130 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 131 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 132 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 133 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 134 */