Source Code Cross Referenced for Syntax.java in  » Search-Engine » semweb4j » org » ontoware » rdf2go » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » semweb4j » org.ontoware.rdf2go.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * LICENSE INFORMATION
003:         * Copyright 2005-2007 by FZI (http://www.fzi.de).
004:         * Licensed under a BSD license (http://www.opensource.org/licenses/bsd-license.php)
005:         * <OWNER> = Max Völkel
006:         * <ORGANIZATION> = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe, Germany
007:         * <YEAR> = 2007
008:         * 
009:         * Project information at http://semweb4j.org/rdf2go
010:         */
011:        package org.ontoware.rdf2go.model;
012:
013:        import java.util.ArrayList;
014:        import java.util.Collections;
015:        import java.util.List;
016:
017:        /**
018:         * Class for RDF syntaxes, and registry for them. A framework can register new
019:         * syntaxes by creating them with the constructor that automatically registers,
020:         * or by calling the {@link #register(Syntax)} method.
021:         * 
022:         * You can chose to use a Syntax in your application without registering it.
023:         * 
024:         * @author voelkel, sauermann
025:         */
026:        public class Syntax {
027:
028:            /**
029:             * List of known RDF file formats. Note: This has to be defined at the top
030:             * of the class, otherwise the constructor of the final Syntaxes cannot use
031:             * it.
032:             */
033:            private static List<Syntax> SYNTAXES = new ArrayList<Syntax>();
034:
035:            /**
036:             * RDF syntax RDF XML
037:             */
038:            public static final Syntax RdfXml = new Syntax("rdfxml",
039:                    "application/rdf+xml", ".rdf", true);
040:
041:            /**
042:             * RDF syntax Turtle
043:             */
044:            public static final Syntax Turtle = new Syntax("turtle",
045:                    "application/x-turtle", ".ttl", true);
046:
047:            /**
048:             * RDF syntax NTriples
049:             */
050:            public static final Syntax Ntriples = new Syntax("ntriples",
051:                    "text/plain", ".nt", true);
052:
053:            /**
054:             * RDF syntax Trix For mroe info see: http://swdev.nokia.com/trix/TriX.html
055:             */
056:            public static final Syntax Trix = new Syntax("trix",
057:                    "application/trix", ".trix", true);
058:
059:            /**
060:             * RDF Syntax Trig For more info see
061:             * http://sites.wiwiss.fu-berlin.de/suhl/bizer/TriG/
062:             */
063:            public static final Syntax Trig = new Syntax("trig",
064:                    "application/x-trig", ".trig", true);
065:
066:            /**
067:             * register a new RDF Syntax you want to have available throughout your
068:             * application.
069:             * 
070:             * @param syntax
071:             *            the new syntax to register.
072:             */
073:            public static void register(Syntax syntax) {
074:                SYNTAXES.add(syntax);
075:            }
076:
077:            /**
078:             * return the RDF syntax with the given name.
079:             * 
080:             * @param name
081:             *            the name of the syntax to search
082:             * @return the syntax or <code>null</code>, if none registered
083:             */
084:            public static Syntax forName(String name) {
085:                for (Syntax x : SYNTAXES) {
086:                    if (x.getName().equals(name))
087:                        return x;
088:                }
089:                return null;
090:            }
091:
092:            /**
093:             * return the RDF syntax with the given MIME-type.
094:             * 
095:             * @param mimeType
096:             *            the MIME-type of the syntax to find
097:             * @return the syntax or <code>null</code>, if none registered
098:             */
099:            public static Syntax forMimeType(String mimeType) {
100:                for (Syntax x : SYNTAXES) {
101:                    if (x.getMimeType().equals(mimeType))
102:                        return x;
103:                }
104:                return null;
105:            }
106:
107:            /**
108:             * unregister an RDF Syntax from which you know that your application will
109:             * never ever support it. This may help you to build user interfaces where
110:             * users can select RDF syntaxes. If the syntax was unknown, returns false
111:             * 
112:             * @param syntax
113:             *            the syntax to unregister
114:             * @return true, if the syntax was found and removed
115:             */
116:            public static boolean unregister(Syntax syntax) {
117:                return SYNTAXES.remove(syntax);
118:            }
119:
120:            /**
121:             * list all available syntaxes. List is not modifyable.
122:             * 
123:             * @return a list of available syntaxes
124:             */
125:            public static List<Syntax> list() {
126:                return Collections.unmodifiableList(SYNTAXES);
127:            }
128:
129:            private final String name;
130:
131:            private final String mimeType;
132:
133:            private final String filenameExtension;
134:
135:            /**
136:             * return the MIME-type of this format.
137:             * 
138:             * @return the MIME type
139:             */
140:            public String getMimeType() {
141:                return mimeType;
142:            }
143:
144:            /**
145:             * @return the common name of this format
146:             */
147:            public String getName() {
148:                return name;
149:            }
150:
151:            /**
152:             * @return the suggested filename-extension, including the leading '.'
153:             */
154:            public String getFilenameExtension() {
155:                return filenameExtension;
156:            }
157:
158:            /**
159:             * Generate a new Syntax
160:             * 
161:             * @param name
162:             *            the name of the RDF syntax
163:             * @param mimeType
164:             *            the MIMEtype of the RDF syntax
165:             */
166:            public Syntax(final String name, final String mimeType,
167:                    final String filenameExtension) {
168:                super ();
169:                this .name = name;
170:                this .mimeType = mimeType;
171:                this .filenameExtension = filenameExtension;
172:            }
173:
174:            /**
175:             * Generate a new Syntax and register it
176:             * 
177:             * @param name
178:             *            the name of the RDF syntax
179:             * @param mimeType
180:             *            the MIMEtype of the RDF syntax
181:             * @param registerItNow
182:             *            register the new Syntax now.
183:             */
184:            public Syntax(final String name, final String mimeType,
185:                    final String filenameExtension, boolean registerItNow) {
186:                this (name, mimeType, filenameExtension);
187:                if (registerItNow)
188:                    register(this );
189:            }
190:
191:            /**
192:             * @see java.lang.Object#equals(java.lang.Object)
193:             */
194:            @Override
195:            public boolean equals(Object obj) {
196:                if (obj instanceof  Syntax) {
197:                    return mimeType.equals(((Syntax) obj).mimeType);
198:                }
199:                return false;
200:            }
201:
202:            /**
203:             * @see java.lang.Object#hashCode()
204:             */
205:            @Override
206:            public int hashCode() {
207:                return mimeType.hashCode();
208:            }
209:
210:            /**
211:             * @see java.lang.Object#toString()
212:             */
213:            @Override
214:            public String toString() {
215:                return "RDF Syntax '" + name + "' MIME-type=" + mimeType;
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.