incubator-any23-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ans...@apache.org
Subject svn commit: r1372269 [2/4] - in /incubator/any23/trunk: ./ api/ api/src/ api/src/main/ api/src/main/java/ api/src/main/java/org/ api/src/main/java/org/apache/ api/src/main/java/org/apache/any23/ api/src/main/java/org/apache/any23/cli/ api/src/main/java...
Date Mon, 13 Aug 2012 06:15:33 GMT
Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Any23PluginManager.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Any23PluginManager.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Any23PluginManager.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Any23PluginManager.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.plugin;
+
+import org.apache.any23.cli.Tool;
+import org.apache.any23.configuration.DefaultConfiguration;
+import org.apache.any23.extractor.ExtractorFactory;
+import org.apache.any23.extractor.ExtractorGroup;
+import org.apache.any23.extractor.ExtractorRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.Set;
+
+/**
+ * The <i>Any23PluginManager</i> is responsible for inspecting
+ * dynamically the classpath and retrieving useful classes.
+ *
+ * @author Michele Mostarda (mostarda@fbk.eu)
+ */
+public class Any23PluginManager {
+
+    /**
+     * Any23 Command Line Interface package.
+     */
+    public static final String CLI_PACKAGE = Tool.class.getPackage().getName();
+
+    /**
+     * Any23 Plugins package.
+     */
+    public static final String PLUGINS_PACKAGE = ExtractorPlugin.class.getPackage().getName();
+
+    /**
+     * Property where look for plugins.
+     */
+    public static final String PLUGIN_DIRS_PROPERTY = "any23.plugin.dirs";
+
+    /**
+     * List separator for the string declaring the plugin list.
+     */
+    public static final String PLUGIN_DIRS_LIST_SEPARATOR = ":";
+
+    /**
+     * Internal logger.
+     */
+    private static final Logger logger = LoggerFactory.getLogger(Any23PluginManager.class);
+
+    /**
+     * Singleton lazy instance.
+     */
+    private static final Any23PluginManager instance = new Any23PluginManager();
+
+    /**
+     * Internal class loader used to dynamically load classes.
+     */
+    private final DynamicClassLoader dynamicClassLoader;
+
+    /**
+     * @return a singleton instance of {@link Any23PluginManager}.
+     */
+    public static synchronized Any23PluginManager getInstance() {
+        return instance;
+    }
+
+    /**
+     * Constructor.
+     */
+    private Any23PluginManager() {
+        dynamicClassLoader = new DynamicClassLoader();
+    }
+
+    /**
+     * Loads a <i>JAR</i> file in the classpath.
+     *
+     * @param jar the JAR file to be loaded.
+     * @return <code>true</code> if the JAR is added for the first time to the classpath,
+     *         <code>false</code> otherwise.
+     * @throws MalformedURLException
+     */
+    public synchronized boolean loadJAR(File jar) {
+        if(jar == null) throw new NullPointerException("jar file cannot be null.");
+        if (!jar.isFile() && !jar.exists()) {
+            throw new IllegalArgumentException(
+                    String.format("Invalid JAR [%s], must be an existing file.", jar.getAbsolutePath())
+            );
+        }
+        return dynamicClassLoader.addJAR(jar);
+    }
+
+    /**
+     * Loads a list of <i>JAR</i>s in the classpath.
+     *
+     * @param jars list of JARs to be loaded.
+     * @return list of exceptions raised during the loading.
+     */
+    public synchronized Throwable[] loadJARs(File... jars) {
+        final List<Throwable> result = new ArrayList<Throwable>();
+        for (File jar : jars) {
+            try {
+                loadJAR(jar);
+            } catch (Throwable t) {
+                result.add(
+                        new IllegalArgumentException(
+                                String.format("Error while loading jar [%s]", jar.getAbsolutePath()),
+                                t
+                        )
+                );
+            }
+        }
+        return result.toArray(new Throwable[result.size()]);
+    }
+
+    /**
+     * Loads a <i>classes</i> directory in the classpath.
+     *
+     * @param classDir the directory to be loaded.
+     * @return <code>true</code> if the directory is added for the first time to the classpath,
+     *         <code>false</code> otherwise.
+     */
+    public synchronized boolean loadClassDir(File classDir) {
+        if(classDir == null) throw new NullPointerException("classDir cannot be null.");
+        if (!classDir.isDirectory() && !classDir.exists()) {
+            throw new IllegalArgumentException(
+                    String.format("Invalid class dir [%s], must be an existing file.", classDir.getAbsolutePath())
+            );
+        }
+        return dynamicClassLoader.addClassDir(classDir);
+    }
+
+    /**
+     * Loads a list of class dirs in the classpath.
+     *
+     * @param classDirs list of class dirs to be loaded.
+     * @return  list of exceptions raised during the loading.
+     */
+    public synchronized Throwable[] loadClassDirs(File... classDirs) {
+        final List<Throwable> result = new ArrayList<Throwable>();
+        for (File classDir : classDirs) {
+            try {
+                loadClassDir(classDir);
+            } catch (Throwable t) {
+                result.add(
+                        new IllegalArgumentException(
+                                String.format("Error while loading class dir [%s]", classDir.getAbsolutePath()),
+                                t
+                        )
+                );
+            }
+        }
+        return result.toArray(new Throwable[result.size()]);
+    }
+
+    /**
+     * Loads all the JARs detected in a given directory.
+     *
+     * @param jarDir directory containing the JARs to be loaded.
+     * @return <code>true</code> if all JARs in dir are loaded.
+     */
+    public synchronized boolean loadJARDir(File jarDir) {
+        if(jarDir == null)
+            throw new NullPointerException("JAR dir must be not null.");
+        if(  ! jarDir.exists() )
+            throw new IllegalArgumentException("Given directory doesn't exist:" + jarDir.getAbsolutePath());
+        if(! jarDir.isDirectory() )
+            throw new IllegalArgumentException(
+                    "given file exists and it is not a directory: " + jarDir.getAbsolutePath()
+            );
+        boolean loaded = true;
+        for (File jarFile : jarDir.listFiles(
+                new FilenameFilter() {
+                    @Override
+                    public boolean accept(File dir, String name) {
+                        return name.endsWith(".jar");
+                    }
+                })
+        ) {
+            loaded &= loadJAR(jarFile);
+        }
+        return loaded;
+    }
+
+    /**
+     * Loads a generic list of files, trying to determine the type of every file.
+     *
+     * @param files list of files to be loaded.
+     * @return list of errors occurred during loading.
+     */
+    public synchronized Throwable[] loadFiles(File... files) {
+        final List<Throwable> errors = new ArrayList<Throwable>();
+        for(File file : files) {
+            try {
+                if (file.isFile() && file.getName().endsWith(".jar")) {
+                    loadJAR(file);
+                } else if (file.isDirectory()) {
+                    if (file.getName().endsWith("classes")) {
+                        loadClassDir(file);
+                    } else {
+                        loadJARDir(file);
+                    }
+                } else {
+                    throw new IllegalArgumentException("Cannot handle file " + file.getAbsolutePath());
+                }
+            } catch (Throwable t) {
+                errors.add(t);
+            }
+        }
+        return errors.toArray(new Throwable[errors.size()]);
+    }
+
+    /**
+     * Returns all classes within the specified <code>packageName</code> satisfying the given class
+     * <code>filter</code>. The search is performed on the static classpath (the one the application
+     * started with) and the dynamic classpath (the one specified using the load methods).
+     *
+     * @param <T> type of filtered class.
+     * @return list of matching classes.
+     * @throws IOException
+     */
+    public synchronized <T> Iterator<T> getPlugins(final Class<T> type)
+    throws IOException {
+        return ServiceLoader.load(type, dynamicClassLoader).iterator();
+    }
+
+    /**
+     * Returns the list of all the {@link Tool} classes declared within the classpath.
+     *
+     * @return not <code>null</code> list of tool classes.
+     * @throws IOException
+     */
+    public synchronized Iterator<Tool> getTools() throws IOException {
+        return getPlugins(Tool.class);
+    }
+
+    /**
+     * List of {@link ExtractorPlugin} classes declared within the classpath.
+     *
+     * @return not <code>null</code> list of plugin classes.
+     * @throws IOException
+     */
+    public synchronized Iterator<ExtractorPlugin> getExtractors() throws IOException {
+        return getPlugins(ExtractorPlugin.class);
+    }
+
+    /**
+     * Loads plugins from a list of specified locations.
+     *
+     * @param pluginLocations list of locations.
+     * @return a report about the loaded plugins.
+     */
+    public synchronized String loadPlugins(File... pluginLocations) {
+        final StringBuilder report = new StringBuilder();
+        report.append("\nLoading plugins from locations {\n");
+        for (File pluginLocation : pluginLocations) {
+            report.append(pluginLocation.getAbsolutePath()).append('\n');
+        }
+        report.append("}\n");
+
+        final Throwable[] errors = loadFiles(pluginLocations);
+        if (errors.length > 0) {
+            report.append("The following errors occurred while loading plugins {\n");
+            for (Throwable error : errors) {
+                report.append(error);
+                report.append("\n\n\n");
+            }
+            report.append("}\n");
+        }
+        return report.toString();
+    }
+
+    /**
+        * Configures a new list of extractors containing the extractors declared in <code>initialExtractorGroup</code>
+        * and also the extractors detected in classpath specified by <code>pluginLocations</code>.
+        *
+        * @param initialExtractorGroup initial list of extractors.
+        * @param pluginLocations
+        * @return full list of extractors.
+        * @throws java.io.IOException
+        * @throws IllegalAccessException
+        * @throws InstantiationException
+        */
+    public synchronized ExtractorGroup configureExtractors(
+            final ExtractorGroup initialExtractorGroup,
+            final File... pluginLocations
+    ) throws IOException, IllegalAccessException, InstantiationException {
+        if (initialExtractorGroup == null) throw new NullPointerException("inExtractorGroup cannot be null");
+
+        final String pluginsReport = loadPlugins(pluginLocations);
+        logger.info(pluginsReport);
+
+        final StringBuilder report = new StringBuilder();
+        try {
+            final List<ExtractorFactory<?>> newFactoryList = new ArrayList<ExtractorFactory<?>>();
+            Iterator<ExtractorPlugin> extractors = getExtractors();
+            while (extractors.hasNext()) {
+                ExtractorFactory<?> factory = extractors.next().getExtractorFactory();
+
+                report.append("\n - found plugin: ").append(factory.getExtractorName()).append("\n");
+
+                newFactoryList.add(factory);
+            }
+
+            if (newFactoryList.isEmpty()) {
+                report.append("\n=== No plugins have been found.===\n");
+            }
+
+            for (ExtractorFactory<?> extractorFactory : initialExtractorGroup) {
+                newFactoryList.add(extractorFactory);
+            }
+
+            return new ExtractorGroup(newFactoryList);
+        } finally {
+            logger.info(report.toString());
+        }
+    }
+
+    /**
+     * Configures a new list of extractors containing the extractors declared in <code>initialExtractorGroup</code>
+     * and also the extractors detected in classpath specified by the default configuration.
+     *
+     * @param initialExtractorGroup initial list of extractors.
+     * @return full list of extractors.
+     * @throws IOException
+     * @throws InstantiationException
+     * @throws IllegalAccessException
+     */
+    public synchronized ExtractorGroup configureExtractors(ExtractorGroup initialExtractorGroup)
+    throws IOException, InstantiationException, IllegalAccessException {
+        final String pluginDirs = DefaultConfiguration.singleton().getPropertyOrFail(PLUGIN_DIRS_PROPERTY);
+        final File[] pluginLocations = getPluginLocations(pluginDirs);
+        return configureExtractors(initialExtractorGroup, pluginLocations);
+    }
+
+    /**
+     * Returns an extractor group containing both the default extractors declared by the
+     * {@link org.apache.any23.extractor.ExtractorRegistry} and the {@link ExtractorPlugin}s.
+     * @param registry TODO
+     * @param pluginLocations optional list of plugin locations.
+     *
+     * @return a not <code>null</code> and not empty extractor group.
+     * @throws java.io.IOException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     */
+    public synchronized ExtractorGroup getApplicableExtractors(ExtractorRegistry registry, File... pluginLocations)
+    throws IOException, IllegalAccessException, InstantiationException {
+        final ExtractorGroup defaultExtractors = registry.getExtractorGroup();
+        return configureExtractors(defaultExtractors, pluginLocations);
+    }
+
+    /**
+     * Returns an {@link Iterator} of tools that have been detected within the given list of locations.
+     *
+     * @param pluginLocations list of plugin locations.
+     * @return set of detected tools.
+     * @throws IOException
+     */
+    public synchronized Iterator<Tool> getApplicableTools(File... pluginLocations) throws IOException {
+        final String report = loadPlugins(pluginLocations);
+        logger.info(report);
+        return getTools();
+    }
+
+    /**
+     * Converts a column separated list of dirs in a list of files.
+     *
+     * @param pluginDirsList
+     * @return
+     */
+    private File[] getPluginLocations(String pluginDirsList) {
+        final String[] locationsStr = pluginDirsList.split(PLUGIN_DIRS_LIST_SEPARATOR);
+        final List<File> locations = new ArrayList<File>();
+        for(String locationStr : locationsStr) {
+            final File location = new File(locationStr);
+            if( ! location.exists()) {
+                throw new IllegalArgumentException(
+                        String.format("Plugin location '%s' cannot be found.", locationStr)
+                );
+            }
+            locations.add(location);
+        }
+        return locations.toArray(new File[locations.size()]);
+    }
+
+    /**
+     * Dynamic local file class loader.
+     */
+    private static final class DynamicClassLoader extends URLClassLoader {
+
+        private final Set<String> addedURLs = new HashSet<String>();
+
+        private final List<File> jars;
+
+        private final List<File> dirs;
+
+        public DynamicClassLoader(URL[] urls) {
+            super(urls, Any23PluginManager.class.getClassLoader());
+            jars = new ArrayList<File>();
+            dirs = new ArrayList<File>();
+        }
+
+        public DynamicClassLoader() {
+            this(new URL[0]);
+        }
+
+        public boolean addClassDir(File classDir) {
+            final String urlPath = "file://" + classDir.getAbsolutePath() + "/";
+            try {
+                if( addURL(urlPath) ) {
+                    dirs.add(classDir);
+                    return true;
+                }
+                return false;
+            } catch (MalformedURLException murle) {
+                throw new RuntimeException("Invalid dir URL.", murle);
+            }
+        }
+
+        public boolean addJAR(File jar) {
+            final String urlPath = "jar:file://" + jar.getAbsolutePath() + "!/";
+            try {
+                if (addURL(urlPath)) {
+                    jars.add(jar);
+                    return true;
+                }
+                return false;
+            } catch (MalformedURLException murle) {
+                throw new RuntimeException("Invalid JAR URL.", murle);
+            }
+        }
+
+        private boolean addURL(String urlPath) throws MalformedURLException {
+            if(addedURLs.contains(urlPath)) {
+                return false;
+            }
+            super.addURL(new URL(urlPath));
+            addedURLs.add(urlPath);
+            return true;
+        }
+    }
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Author.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Author.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Author.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/Author.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.plugin;
+
+/**
+ * Describes the author of the plugin.
+ *
+ * @author Michele Mostarda (mostarda@fbk.eu)
+ */
+public @interface Author {
+
+    /**
+     * @return The author's name.
+     */
+    String name();
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/ExtractorPlugin.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/ExtractorPlugin.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/ExtractorPlugin.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/ExtractorPlugin.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.plugin;
+
+import org.apache.any23.extractor.Extractor;
+import org.apache.any23.extractor.ExtractorFactory;
+
+/**
+ * This interface defines an {@link org.apache.any23.cli.Any23}
+ * extractor plugin that can be detected and registered from the library classpath.
+ *
+ * @author Michele Mostarda (mostarda@fbk.eu)
+ */
+public interface ExtractorPlugin<T extends Extractor<?>> {
+
+    /**
+     * @return the {@link org.apache.any23.extractor.ExtractorFactory} for the plugin.
+     */
+    ExtractorFactory<T> getExtractorFactory();
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/package-info.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/package-info.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/package-info.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/plugin/package-info.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This package provides <i>Plugin Management</i> support for <i>Any23</i>.
+ */
+package org.apache.any23.plugin;
\ No newline at end of file

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/rdf/Prefixes.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/rdf/Prefixes.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/rdf/Prefixes.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/rdf/Prefixes.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.rdf;
+
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.ValueFactoryImpl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * A mapping from prefixes to namespace URIs. Supports "volatile mappings",
+ * which will be overwritten without notice when mappings are merged,
+ * while for normal mappings this causes an exception. This allows
+ * combining "hard" mappings (which must be retained or something breaks)
+ * and "soft" mappings (which might be read from input RDF files and
+ * should be retained only if they are not in conflict with the hard ones).
+ *
+ * @author Richard Cyganiak (richard@cyganiak.de)
+ */
+public class Prefixes {
+
+    public static Prefixes create1(String prefix, String namespaceURI) {
+        Prefixes result = new Prefixes();
+        result.add(prefix, namespaceURI);
+        return result;
+    }
+
+    public static Prefixes createFromMap(Map<String, String> prefixesToNamespaceURIs, boolean areVolatile) {
+        Prefixes result = new Prefixes();
+        for (Entry<String, String> entry : prefixesToNamespaceURIs.entrySet()) {
+            if (areVolatile) {
+                result.addVolatile(entry.getKey(), entry.getValue());
+            } else {
+                result.add(entry.getKey(), entry.getValue());
+            }
+        }
+        return result;
+    }
+
+    public static Prefixes EMPTY = new Prefixes(Collections.<String, String>emptyMap());
+
+    private final Map<String, String> mappings;
+    private final Set<String> volatilePrefixes = new HashSet<String>();
+
+    public Prefixes() {
+        this(new HashMap<String, String>());
+    }
+
+    public Prefixes(Prefixes initial) {
+        this();
+        add(initial);
+    }
+
+    private Prefixes(Map<String, String> mappings) {
+        this.mappings = mappings;
+    }
+
+    public URI expand(String curie) {
+        String prefix = parsePrefix(curie);
+        if (prefix == null || !hasPrefix(prefix)) {
+            return null;
+        }
+        return ValueFactoryImpl.getInstance().createURI(
+                getNamespaceURIFor(prefix) + parseLocalName(curie));
+    }
+
+    public String abbreviate(String uri) {
+        for (Entry<String, String> namespace : mappings.entrySet()) {
+            if (uri.startsWith(namespace.getValue())) {
+                return namespace.getKey() + ":" +
+                        uri.substring(namespace.getValue().length());
+            }
+        }
+        return null;
+    }
+
+    public boolean canExpand(String curie) {
+        String prefix = parsePrefix(curie);
+        return prefix != null && hasPrefix(prefix);
+    }
+
+    public boolean canAbbreviate(String uri) {
+        for (Entry<String, String> namespace : mappings.entrySet()) {
+            if (uri.startsWith(namespace.getValue())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public String getNamespaceURIFor(String prefix) {
+        return mappings.get(prefix);
+    }
+
+    public boolean hasNamespaceURI(String uri) {
+        return mappings.containsValue(uri);
+    }
+
+    public boolean hasPrefix(String prefix) {
+        return mappings.containsKey(prefix);
+    }
+
+    public Set<String> allPrefixes() {
+        return mappings.keySet();
+    }
+
+    public boolean isEmpty() {
+        return mappings.isEmpty();
+    }
+
+    public void add(String prefix, String namespaceURI) {
+        if (isVolatile(prefix)) {
+            volatilePrefixes.remove(prefix);
+        } else {
+            if (hasPrefix(prefix)) {
+                if (getNamespaceURIFor(prefix).equals(namespaceURI)) {
+                    return;    // re-assigned same prefix to same URI, let's just ignore it
+                }
+                throw new IllegalStateException("Attempted to re-assign prefix '" + prefix +
+                        "'; clashing values '" + getNamespaceURIFor(prefix) + "' and '" +
+                        namespaceURI);
+            }
+        }
+        mappings.put(prefix, namespaceURI);
+    }
+
+    public void add(Prefixes other) {
+        for (String otherPrefix : other.allPrefixes()) {
+            if (other.isVolatile(otherPrefix)) {
+                addVolatile(otherPrefix, other.getNamespaceURIFor(otherPrefix));
+            } else {
+                add(otherPrefix, other.getNamespaceURIFor(otherPrefix));
+            }
+        }
+    }
+
+    public void removePrefix(String prefix) {
+        mappings.remove(prefix);
+        volatilePrefixes.remove(prefix);
+    }
+
+    public Prefixes createSubset(String... prefixes) {
+        Prefixes result = new Prefixes();
+        for (String prefix : prefixes) {
+            if (!hasPrefix(prefix)) {
+                throw new IllegalArgumentException("No namespace URI declared for prefix " + prefix);
+            }
+            result.add(prefix, getNamespaceURIFor(prefix));
+        }
+        return result;
+    }
+
+    public void addVolatile(String prefix, String namespaceURI) {
+        if (hasPrefix(prefix)) {
+            return;    // new prefix is volatile, so we don't overwrite the old one
+        }
+        mappings.put(prefix, namespaceURI);
+        volatilePrefixes.add(prefix);
+    }
+
+    public void addVolatile(Prefixes other) {
+        for (String otherPrefix : other.allPrefixes()) {
+            addVolatile(otherPrefix, other.getNamespaceURIFor(otherPrefix));
+        }
+    }
+
+    public boolean isVolatile(String prefix) {
+        return volatilePrefixes.contains(prefix);
+    }
+
+    private Map<String, String> mapUnmodifiable = null;
+
+    public Map<String, String> asMap() {
+        // Optimization: Create the unmodifiable map only once, lazily
+        if (mapUnmodifiable == null) {
+            mapUnmodifiable = Collections.unmodifiableMap(mappings);
+        }
+        return mapUnmodifiable;
+    }
+
+    private String parsePrefix(String curie) {
+        int index = curie.indexOf(':');
+        if (index == -1) {
+            throw new IllegalArgumentException("Not a CURIE: '" + curie + "'");
+        }
+        return curie.substring(0, index);
+    }
+
+    private String parseLocalName(String curie) {
+        int index = curie.indexOf(':');
+        if (index == -1) {
+            throw new IllegalArgumentException("Not a CURIE: '" + curie + "'");
+        }
+        return curie.substring(index + 1);
+    }
+    
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/source/DocumentSource.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/source/DocumentSource.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/source/DocumentSource.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/source/DocumentSource.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.source;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A source of input streams. Mostly intended for
+ * situations where opening of an input stream is
+ * to be delayed.
+ *
+ * @author Richard Cyganiak (richard@cyganiak.de)
+ */
+public interface DocumentSource {
+
+    /**
+     * Returns the input stream for accessing the content of the document.
+     *
+     * @return not <code>null</code> input stream for accessing document data.
+     * @throws IOException
+     */
+    InputStream openInputStream() throws IOException;
+
+    /**
+     * @return a string describing the content type of the provided document.
+     */
+    public String getContentType();
+
+    /**
+     * @return the size of the content length in bytes.
+     */
+    public long getContentLength();
+
+    /**
+     * @return the actual, final, canonical URI if redirects occur.
+     */
+    public String getDocumentURI();
+
+    /**
+     * A value of <tt>false</tt> indicates that the document
+     * resides remotely, and that multiple successive accesses
+     * to it should be avoided by copying it to local storage.
+     * This can also be used for sources that do not support
+     * multiple calls to {@link #openInputStream()}.
+     */
+    public boolean isLocal();
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/CSV.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/CSV.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/CSV.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/CSV.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * This vocabulary models the structure of a <i>CSV</i> file
+ * according the <a href="http://www.ietf.org/rfc/rfc4180.txt">RFC 4180</a>.
+ *
+ * @author Davide Palmisano (dpalmisano@gmail.com)
+ */
+public class CSV extends Vocabulary {
+
+    public static final String ROW = "row";
+
+    public static final String ROW_POSITION= "rowPosition";
+
+    public static final String NUMBER_OF_ROWS = "numberOfRows";
+
+    public static final String NUMBER_OF_COLUMNS = "numberOfColumns";
+
+    public static final String COLUMN_POSITION= "columnPosition";
+
+    public static final String ROW_TYPE = "Row";
+
+    /**
+     * This property links the identifier of a <i>CSV</i> to an entity representing
+     * a row.
+     */
+    public final URI row = createProperty(ROW);
+
+    /**
+     * This property expresses the index of a row in a <i>CSV</i> file.
+     */
+    public final URI rowPosition = createProperty(ROW_POSITION);
+
+    /**
+     * This property expresses the number of rows in a <i>CSV</i> file.
+     */
+    public final URI numberOfRows = createProperty(NUMBER_OF_ROWS);
+
+    /**
+     * This property expresses the number of columns in a <i>CSV</i> file.
+     */
+    public final URI numberOfColumns = createProperty(NUMBER_OF_COLUMNS);
+
+    /**
+     * This resource identifies a <i>Row</i>.
+     */
+    public final URI rowType = createResource(ROW_TYPE);
+
+    /**
+     * This property expresses the index of a column in a <i>CSV</i> file.
+     */
+    public URI columnPosition = createProperty(COLUMN_POSITION);
+
+    /**
+     * The namespace of the vocabulary as a string.
+     */
+    public static final String NS = "http://vocab.sindice.net/csv/";
+
+    private static CSV instance;
+
+    public static CSV getInstance() {
+        if (instance == null) {
+            instance = new CSV();
+        }
+        return instance;
+    }
+
+    public URI createResource(String localName) {
+        return createProperty(NS, localName);
+    }
+
+    /**
+     *
+     * @param localName
+     * @return the new URI instance.
+     */
+    public URI createProperty(String localName) {
+        return createProperty(NS, localName);
+    }
+
+    private CSV() {
+        super(NS);
+    }
+
+}
\ No newline at end of file

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DCTERMS.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DCTERMS.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DCTERMS.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DCTERMS.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * The <i>DCTERMS</code> vocabulary.
+ * See <a href="http://dublincore.org/">Dublin Core</a>.
+ */
+public class DCTERMS extends Vocabulary {
+
+    public static final String NS = "http://purl.org/dc/terms/";
+
+    private static DCTERMS instance;
+
+    public static DCTERMS getInstance() {
+        if(instance == null) {
+            instance = new DCTERMS();
+        }
+        return instance;
+    }
+
+    // Properties
+    public final URI license = createProperty(NS, "license");
+    public final URI title   = createProperty(NS, "title"  );
+    public final URI creator = createProperty(NS, "creator");
+    public final URI related = createProperty(NS, "related");
+    public final URI date    = createProperty(NS, "date"   );
+    public final URI source  = createProperty(NS, "source" );
+
+    private DCTERMS(){
+        super(NS);
+    }
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DOAC.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DOAC.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DOAC.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/DOAC.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * The <a href="http://ramonantonio.net/doac/0.1/">Description Of A Career</a> vocabulary.
+ */
+public class DOAC extends Vocabulary {
+
+    public static final String NS = "http://ramonantonio.net/doac/0.1/#";
+
+    private static DOAC instance;
+
+    public static DOAC getInstance() {
+        if(instance == null) {
+            instance = new DOAC();
+        }
+        return instance;
+    }
+
+    // Properties.
+    public final URI summary             = createProperty(NS, "summary");
+    public final URI end_date            = createProperty(NS, "end-date");
+    public final URI publication         = createProperty(NS, "publication");
+    public final URI title               = createProperty(NS, "title");
+    public final URI reference           = createProperty(NS, "reference");
+    public final URI language            = createProperty(NS, "language");
+    public final URI experience          = createProperty(NS, "experience");
+    public final URI organization        = createProperty(NS, "organization");
+    public final URI affiliation         = createProperty(NS, "affiliation");
+    public final URI writes              = createProperty(NS, "writes");
+    public final URI start_date          = createProperty(NS, "start-date");
+    public final URI education           = createProperty(NS, "education");
+    public final URI skill               = createProperty(NS, "skill");
+    public final URI referer             = createProperty(NS, "referer");
+    public final URI isco88_code         = createProperty(NS, "isco88-code");
+    public final URI speaks              = createProperty(NS, "speaks");
+    public final URI reads               = createProperty(NS, "reads");
+    public final URI reference_type      = createProperty(NS, "reference-type");
+
+    // Resources.
+    public final URI Publication         = createClass(NS, "Publication");
+    public final URI Education           = createClass(NS, "Education");
+    public final URI OrganisationalSkill = createClass(NS, "OrganisationalSkill");
+    public final URI PrimarySchool       = createClass(NS, "PrimarySchool");
+    public final URI Reference           = createClass(NS, "Reference");
+    public final URI DrivingSkill        = createClass(NS, "DrivingSkill");
+    public final URI Degree              = createClass(NS, "Degree");
+    public final URI LanguageSkill       = createClass(NS, "LanguageSkill");
+    public final URI Skill               = createClass(NS, "Skill");
+    public final URI SecondarySchool     = createClass(NS, "SecondarySchool");
+    public final URI Course              = createClass(NS, "Course");
+    public final URI Experience          = createClass(NS, "Experience");
+    public final URI SocialSkill         = createClass(NS, "SocialSkill");
+    public final URI ComputerSkill       = createClass(NS, "ComputerSkill");
+    public final URI LanguageLevel       = createClass(NS, "LanguageLevel");
+
+    private DOAC(){
+        super(NS);
+    }
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/FOAF.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/FOAF.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/FOAF.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/FOAF.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * The <a href="http://xmlns.com/foaf/spec/">Fried Of A Friend</a> vocabulary.
+ */
+public class FOAF extends Vocabulary {
+
+    public static final String NS = "http://xmlns.com/foaf/0.1/";
+
+    private static FOAF instance;
+
+    public static FOAF getInstance() {
+        if(instance == null) {
+            instance = new FOAF();
+        }
+        return instance;
+    }
+
+    // Properties.
+    public final URI topic_interest          = createProperty(NS, "topic_interest");
+    public final URI phone                   = createProperty(NS, "phone");
+    public final URI icqChatID               = createProperty(NS, "icqChatID");
+    public final URI yahooChatID             = createProperty(NS, "yahooChatID");
+    public final URI member                  = createProperty(NS, "member");
+    public final URI givenname               = createProperty(NS, "givenname");
+    public final URI birthday                = createProperty(NS, "birthday");
+    public final URI img                     = createProperty(NS, "img");
+    public final URI name                    = createProperty(NS, "name");
+    public final URI maker                   = createProperty(NS, "maker");
+    public final URI tipjar                  = createProperty(NS, "tipjar");
+    public final URI membershipClass         = createProperty(NS, "membershipClass");
+    public final URI accountName             = createProperty(NS, "accountName");
+    public final URI mbox_sha1sum            = createProperty(NS, "mbox_sha1sum");
+    public final URI geekcode                = createProperty(NS, "geekcode");
+    public final URI interest                = createProperty(NS, "interest");
+    public final URI depicts                 = createProperty(NS, "depicts");
+    public final URI knows                   = createProperty(NS, "knows");
+    public final URI homepage                = createProperty(NS, "homepage");
+    public final URI firstName               = createProperty(NS, "firstName");
+    public final URI surname                 = createProperty(NS, "surname");
+    public final URI isPrimaryTopicOf        = createProperty(NS, "isPrimaryTopicOf");
+    public final URI page                    = createProperty(NS, "page");
+    public final URI accountServiceHomepage  = createProperty(NS, "accountServiceHomepage");
+    public final URI depiction               = createProperty(NS, "depiction");
+    public final URI fundedBy                = createProperty(NS, "fundedBy");
+    public final URI title                   = createProperty(NS, "title");
+    public final URI weblog                  = createProperty(NS, "weblog");
+    public final URI logo                    = createProperty(NS, "logo");
+    public final URI workplaceHomepage       = createProperty(NS, "workplaceHomepage");
+    public final URI based_near              = createProperty(NS, "based_near");
+    public final URI thumbnail               = createProperty(NS, "thumbnail");
+    public final URI primaryTopic            = createProperty(NS, "primaryTopic");
+    public final URI aimChatID               = createProperty(NS, "aimChatID");
+    public final URI made                    = createProperty(NS, "made");
+    public final URI workInfoHomepage        = createProperty(NS, "workInfoHomepage");
+    public final URI currentProject          = createProperty(NS, "currentProject");
+    public final URI holdsAccount            = createProperty(NS, "holdsAccount");
+    public final URI publications            = createProperty(NS, "publications");
+    public final URI sha1                    = createProperty(NS, "sha1");
+    public final URI gender                  = createProperty(NS, "gender");
+    public final URI mbox                    = createProperty(NS, "mbox");
+    public final URI myersBriggs             = createProperty(NS, "myersBriggs");
+    public final URI plan                    = createProperty(NS, "plan");
+    public final URI pastProject             = createProperty(NS, "pastProject");
+    public final URI schoolHomepage          = createProperty(NS, "schoolHomepage");
+    public final URI family_name             = createProperty(NS, "family_name");
+    public final URI msnChatID               = createProperty(NS, "msnChatID");
+    public final URI theme                   = createProperty(NS, "theme");
+    public final URI topic                   = createProperty(NS, "topic");
+    public final URI dnaChecksum             = createProperty(NS, "dnaChecksum");
+    public final URI nick                    = createProperty(NS, "nick");
+    public final URI jabberID                = createProperty(NS, "jabberID");
+
+    // Resources.
+    public final URI Person                  = createClass(NS, "Person");
+    public final URI PersonalProfileDocument = createClass(NS, "PersonalProfileDocument");
+    public final URI Project                 = createClass(NS, "Project");
+    public final URI OnlineChatAccount       = createClass(NS, "OnlineChatAccount");
+    public final URI OnlineAccount           = createClass(NS, "OnlineAccount");
+    public final URI Agent                   = createClass(NS, "Agent");
+    public final URI Group                   = createClass(NS, "Group");
+    public final URI OnlineGamingAccount     = createClass(NS, "OnlineGamingAccount");
+    public final URI OnlineEcommerceAccount  = createClass(NS, "OnlineEcommerceAccount");
+    public final URI Document                = createClass(NS, "Document");
+    public final URI Organization            = createClass(NS, "Organization");
+    public final URI Image                   = createClass(NS, "Image");
+
+    private FOAF(){
+        super(NS);
+    }
+    
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/GEO.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/GEO.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/GEO.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/GEO.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * The <a href="http://www.geonames.org/ontology/">GEO Names</a> vocabulary.
+ */
+public class GEO extends Vocabulary {
+
+    public static final String NS = "http://www.w3.org/2003/01/geo/wgs84_pos#";
+
+    private static Vocabulary instance;
+
+    public static Vocabulary getInstance() {
+        if(instance == null) {
+            instance = new GEO();
+        }
+        return instance;
+    }
+
+    // Resources.
+    public final URI Point = createClass(NS, "Point");
+
+    // Properties
+    public final URI lat = createProperty(NS, "lat" );
+    public final URI lon = createProperty(NS, "long");
+
+    private GEO(){
+        super(NS);
+    }
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HLISTING.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HLISTING.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HLISTING.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HLISTING.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * Class modeling the <a href="http://microformats.org/wiki/hlisting-proposal">hListing</a> vocabulary.
+ *
+ * @author Davide Palmisano (dpalmisano@gmail.com)
+ * 
+ */
+public class HLISTING extends Vocabulary {
+
+    public static final String NS = "http://sindice.com/hlisting/0.1/";
+
+    private static HLISTING instance;
+
+    public static HLISTING getInstance() {
+        if(instance == null) {
+            instance = new HLISTING();
+        }
+        return instance;
+    }
+
+    // Resources.
+    public final URI Listing = createClass("Listing");
+    public final URI Lister  = createClass("Lister" ); // isa FOAF.Person
+    public final URI Item    = createClass("Item"   ); // isa ?
+
+    // Properties.
+    public final URI action = createProperty("action");
+    public final URI lister = createProperty("lister"); // ranges over Lister
+    public final URI item   = createProperty("item"  );
+
+    public final URI sell     = createClass("sell"    );
+    public final URI rent     = createClass("rent"    );
+    public final URI trade    = createClass("trade"   );
+    public final URI meet     = createClass("meet"    );
+    public final URI announce = createClass("announce");
+    public final URI offer    = createClass("offer"   );
+    public final URI wanted   = createClass("wanted"  );
+    public final URI event    = createClass("event"   );
+    public final URI service  = createClass("service" );
+
+    public final URI tel       = VCARD.getInstance().tel;
+    public final URI dtlisted  = createProperty("dtlisted" );
+    public final URI dtexpired = createProperty("dtexpired");
+    public final URI price     = createProperty("price"    );
+
+    public final URI description = createProperty("description");
+    public final URI summary     = createProperty("summary"    );
+    public final URI permalink   = createProperty("permalink"  );
+
+    public final URI region          = VCARD.getInstance().region;
+    public final URI postOfficeBox   = VCARD.getInstance().post_office_box;
+    public final URI locality        = VCARD.getInstance().locality;
+    public final URI extendedAddress = VCARD.getInstance().extended_address;
+    public final URI streetAddress   = VCARD.getInstance().street_address;
+    public final URI postalCode      = VCARD.getInstance().postal_code;
+    public final URI countryName     = VCARD.getInstance().country_name;
+
+    public final URI listerUrl  = createProperty("listerUrl" );
+    public final URI listerName = createProperty("listerName");
+    public final URI itemName   = createProperty("itemName"  );
+    public final URI itemUrl    = createProperty("itemUrl"   );
+    public final URI itemPhoto  = createProperty("itemPhoto" );
+    public final URI listerOrg  = createProperty("listerOrg" );
+    public final URI listerLogo = createProperty("listerLogo");
+
+    private URI createProperty(String localName) {
+        return createProperty(NS, localName);
+    }
+
+    private URI createClass(String localName) {
+        return createClass(NS, localName);
+    }
+
+    private HLISTING(){
+        super(NS);
+    }
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HRECIPE.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HRECIPE.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HRECIPE.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/HRECIPE.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * Vocabulary to map the <a href="http://microformats.org/wiki/hrecipe">hRecipe</a> microformat.
+ *
+ * @author Michele Mostarda (mostarda@fbk.eu)
+ */
+public class HRECIPE extends Vocabulary {
+
+    public static final String NS = SINDICE.NS + "hrecipe/";
+
+    private static HRECIPE instance;
+
+    public static HRECIPE getInstance() {
+        if(instance == null) {
+            instance = new HRECIPE();
+        }
+        return instance;
+    }
+
+    // Resources.
+    public URI Recipe     = createClass(NS, "Recipe");
+    public URI Duration   = createClass(NS, "Duration");
+    public URI Ingredient = createClass(NS, "Ingredient");
+    public URI Nutrition  = createClass(NS, "Nutrition");
+
+    // Properties.
+    public URI fn                     = createProperty(NS, "fn");
+    public URI duration               = createProperty(NS, "duration");
+    public URI durationTitle          = createProperty(NS, "durationTitle");
+    public URI durationTime           = createProperty(NS, "durationTime");
+    public URI photo                  = createProperty(NS, "photo");
+    public URI summary                = createProperty(NS, "summary");
+    public URI author                 = createProperty(NS, "author");
+    public URI published              = createProperty(NS, "published");
+    public URI nutrition              = createProperty(NS, "nutrition");
+    public URI nutritionValue         = createProperty(NS, "nutritionValue");
+    public URI nutritionValueType     = createProperty(NS, "nutritionValueType");
+    public URI tag                    = createProperty(NS, "tag");
+    public URI ingredient             = createProperty(NS, "ingredient");
+    public URI ingredientName         = createProperty(NS, "ingredientName");
+    public URI ingredientQuantity     = createProperty(NS, "ingredientQuantity");
+    public URI ingredientQuantityType = createProperty(NS, "ingredientQuantityType");
+    public URI instructions           = createProperty(NS, "instructions");
+    public URI yield                  = createProperty(NS, "yield");
+
+    private HRECIPE() {
+        super(NS);
+    }
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/ICAL.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/ICAL.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/ICAL.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/ICAL.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,527 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * Vocabulary definitions from <code>ical.rdf</code>
+ */
+public class ICAL extends Vocabulary {
+
+    /**
+     * The namespace of the vocabulary as a string.
+     */
+    public static final String NS = "http://www.w3.org/2002/12/cal/icaltzd#";
+
+    private static ICAL instance;
+
+    public static ICAL getInstance() {
+        if(instance == null) {
+            instance = new ICAL();
+        }
+        return instance;
+    }
+
+    /**
+     * The namespace of the vocabulary as a URI.
+     */
+    public final URI NAMESPACE = createURI(NS);
+
+    public final URI DomainOf_rrule = createClass("DomainOf_rrule");
+    public final URI List_of_Float  = createClass("List_of_Float");
+
+    /**
+     * Provide a grouping of component properties that define an alarm..
+     */
+    public final URI Valarm            = createClass("Valarm");
+
+    public final URI Value_CAL_ADDRESS = createClass("Value_CAL-ADDRESS");
+
+    public final URI Value_DATE        = createClass("Value_DATE");
+
+    public final URI Value_DURATION    = createClass("Value_DURATION");
+
+    public final URI Value_PERIOD      = createClass("Value_PERIOD");
+
+    public final URI Value_RECUR       = createClass("Value_RECUR");
+
+    public final URI Vcalendar         = createClass("vcalendar");
+
+    /**
+     * Provide a grouping of component properties that describe an event..
+     */
+    public final URI Vevent = createClass("Vevent");
+
+    /**
+     * Provide a grouping of component properties that describe either a request
+     * for free/busy time, describe a response to a request for free/busy time or
+     * describe a published set of busy time..
+     */
+    public final URI Vfreebusy = createClass("Vfreebusy");
+
+    /**
+     * Provide a grouping of component properties that describe a journal entry..
+     */
+    public final URI Vjournal = createClass("Vjournal");
+
+    /**
+     * Provide a grouping of component properties that defines a time zone..
+     */
+    public final URI Vtimezone = createClass("Vtimezone");
+
+    /**
+     * Provide a grouping of calendar properties that describe a to-do..
+     */
+    public final URI Vtodo = createClass("Vtodo");
+
+
+    /**
+     * The URI provides the capability to associate a document object with a
+     * calendar component.default value type: URI.
+     */
+    public final URI attach = createProperty("attach");
+
+    /**
+     * The URI defines an "Attendee" within a calendar component.value type:
+     * CAL-ADDRESS.
+     */
+    public final URI attendee   = createProperty("attendee");
+    public final URI calAddress = createProperty("calAddress");
+    public final URI component  = createProperty("component");
+    public final URI daylight  = createProperty("daylight");
+
+    /**
+     * The URI specifies a positive duration of time.value type: DURATION.
+     */
+    public final URI duration = createProperty("duration");
+
+    /**
+     * This URI defines a rule or repeating pattern for an exception to a recurrence
+     * set.value type: RECUR.
+     */
+    public final URI exrule = createProperty("exrule");
+
+    /**
+     * The URI defines one or more free or busy time intervals.value type: PERIOD.
+     */
+    public final URI freebusy = createProperty("freebusy");
+
+    /**
+     * value type: list of FLOATThis URI specifies information related to the
+     * global position for the activity specified by a calendar component..
+     */
+    public final URI geo = createProperty("geo");
+
+    /**
+     * value type: CAL-ADDRESSThe URI defines the organizer for a calendar component..
+     */
+    public final URI organizer = createProperty("organizer");
+
+    /**
+     * This URI defines a rule or repeating pattern for recurring events, to-dos,
+     * or time zone definitions.value type: RECUR.
+     */
+    public final URI rrule = createProperty("rrule");
+
+    public final URI standard = createProperty("standard");
+
+    /**
+     * This URI specifies when an alarm will trigger.default value type: DURATION.
+     */
+    public final URI trigger = createProperty("trigger");
+
+    /**
+     * The TZURL provides a means for a VTIMEZONE component to point to a network
+     * location that can be used to retrieve an up-to- date version of itself.value
+     * type: URI.
+     */
+    public final URI tzurl = createProperty("tzurl");
+
+    /**
+     * This URI defines a Uniform URI Locator (URL) associated with the
+     * iCalendar object.value type: URI.
+     */
+    public final URI url = createProperty("url");
+
+    /**
+     * value type: TEXTThis class of URI provides a framework for defining non-standard
+     * properties..
+     */
+    public final URI X_ = createProperty("X-");
+
+    /**
+     * value type: TEXTThis URI defines the action to be invoked when an alarm
+     * is triggered..
+     */
+    public final URI action = createProperty("action");
+
+    /**
+     * To specify an alternate text representation for the URI value..
+     */
+    public final URI altrep = createProperty("altrep");
+
+    public final URI byday = createProperty("byday");
+
+    public final URI byhour = createProperty("byhour");
+
+    public final URI byminute = createProperty("byminute");
+
+    public final URI bymonth = createProperty("bymonth");
+
+    public final URI bysecond = createProperty("bysecond");
+
+    public final URI bysetpos = createProperty("bysetpos");
+
+    public final URI byweekno = createProperty("byweekno");
+
+    public final URI byyearday = createProperty("byyearday");
+
+    /**
+     * value type: TEXTThis URI defines the calendar scale used for the calendar
+     * information specified in the iCalendar object..
+     */
+    public final URI calscale = createProperty("calscale");
+
+    /**
+     * value type: TEXTThis URI defines the categories for a calendar component..
+     */
+    public final URI categories = createProperty("categories");
+
+    /**
+     * value type: TEXTThis URI defines the access classification for a calendar
+     * component..
+     */
+    public final URI class_ = createProperty("class");
+
+    /**
+     * To specify the common name to be associated with the calendar user specified
+     * by the URI..
+     */
+    public final URI cn = createProperty("cn");
+
+    /**
+     * value type: TEXTThis URI specifies non-processing information intended
+     * to provide a comment to the calendar user..
+     */
+    public final URI comment = createProperty("comment");
+
+    /**
+     * value type: DATE-TIMEThis URI defines the date and time that a to-do
+     * was actually completed..
+     */
+    public final URI completed = createProperty("completed");
+
+    /**
+     * value type: TEXTThe URI is used to represent contact information or alternately
+     * a reference to contact information associated with the calendar component..
+     */
+    public final URI contact = createProperty("contact");
+
+    public final URI count = createProperty("count");
+
+    /**
+     * This URI specifies the date and time that the calendar information was
+     * created by the calendar user agent in the calendar store. Note: This is analogous
+     * to the creation date and time for a file in the file system.value type: DATE-TIME.
+     */
+    public final URI created = createProperty("created");
+
+    /**
+     * To specify the type of calendar user specified by the URI..
+     */
+    public final URI cutype = createProperty("cutype");
+
+    /**
+     * To specify the calendar users that have delegated their participation to the
+     * calendar user specified by the URI..
+     */
+    public final URI delegatedFrom = createProperty("delegatedFrom");
+
+    /**
+     * To specify the calendar users to whom the calendar user specified by the URI
+     * has delegated participation..
+     */
+    public final URI delegatedTo = createProperty("delegatedTo");
+
+    /**
+     * value type: TEXTThis URI provides a more complete description of the
+     * calendar component, than that provided by the "SUMMARY" URI..
+     */
+    public final URI description = createProperty("description");
+
+    /**
+     * To specify reference to a directory entry associated with the calendar user
+     * specified by the URI..
+     */
+    public final URI dir = createProperty("dir");
+
+    /**
+     * This URI specifies the date and time that a calendar component ends.default
+     * value type: DATE-TIME.
+     */
+    public final URI dtend = createProperty("dtend");
+
+    /**
+     * value type: DATE-TIMEThe URI indicates the date/time that the instance
+     * of the iCalendar object was created..
+     */
+    public final URI dtstamp = createProperty("dtstamp");
+
+    /**
+     * default value type: DATE-TIMEThis URI specifies when the calendar component
+     * begins..
+     */
+    public final URI dtstart = createProperty("dtstart");
+
+    /**
+     * default value type: DATE-TIMEThis URI defines the date and time that
+     * a to-do is expected to be completed..
+     */
+    public final URI due = createProperty("due");
+
+    /**
+     * To specify an alternate inline encoding for the URI value..
+     */
+    public final URI encoding = createProperty("encoding");
+
+    /**
+     * default value type: DATE-TIMEThis URI defines the list of date/time exceptions
+     * for a recurring calendar component..
+     */
+    public final URI exdate = createProperty("exdate");
+
+    /**
+     * To specify the free or busy time type..
+     */
+    public final URI fbtype = createProperty("fbtype");
+
+    /**
+     * To specify the content type of a referenced object..
+     */
+    public final URI fmttype = createProperty("fmttype");
+
+    public final URI freq = createProperty("freq");
+
+    public final URI interval = createProperty("interval");
+
+    /**
+     * To specify the language for text values in a URI or URI parameter..
+     */
+    public final URI language = createProperty("language");
+
+    /**
+     * value type: DATE-TIMEThe URI specifies the date and time that the information
+     * associated with the calendar component was last revised in the calendar store.
+     * Note: This is analogous to the modification date and time for a file in the
+     * file system..
+     */
+    public final URI lastModified = createProperty("lastModified");
+
+    /**
+     * value type: TEXTThe URI defines the intended venue for the activity defined
+     * by a calendar component..
+     */
+    public final URI location = createProperty("location");
+
+    /**
+     * To specify the group or list membership of the calendar user specified by
+     * the URI..
+     */
+    public final URI member = createProperty("member");
+
+    /**
+     * value type: TEXTThis URI defines the iCalendar object method associated
+     * with the calendar object..
+     */
+    public final URI method = createProperty("method");
+
+    /**
+     * To specify the participation status for the calendar user specified by the
+     * URI..
+     */
+    public final URI partstat = createProperty("partstat");
+
+    /**
+     * value type: INTEGERThis URI is used by an assignee or delegatee of a
+     * to-do to convey the percent completion of a to-do to the Organizer..
+     */
+    public final URI percentComplete = createProperty("percentComplete");
+
+    /**
+     * The URI defines the relative priority for a calendar component.value
+     * type: INTEGER.
+     */
+    public final URI priority = createProperty("priority");
+
+    /**
+     * value type: TEXTThis URI specifies the identifier for the product that
+     * created the iCalendar object..
+     */
+    public final URI prodid = createProperty("prodid");
+
+    /**
+     * To specify the effective range of recurrence instances from the instance specified
+     * by the recurrence identifier specified by the URI..
+     */
+    public final URI range = createProperty("range");
+
+    /**
+     * default value type: DATE-TIMEThis URI defines the list of date/times
+     * for a recurrence set..
+     */
+    public final URI rdate = createProperty("rdate");
+
+    /**
+     * default value type: DATE-TIMEThis URI is used in conjunction with the
+     * "UID" and "SEQUENCE" URI to identify a specific instance of a recurring
+     * "VEVENT", "VTODO" or "VJOURNAL" calendar component. The URI value is
+     * the effective value of the "DTSTART" URI of the recurrence instance..
+     */
+    public final URI recurrenceId = createProperty("recurrenceId");
+
+    /**
+     * To specify the relationship of the alarm trigger with respect to the start
+     * or end of the calendar component..
+     */
+    public final URI related = createProperty("related");
+
+    /**
+     * The URI is used to represent a relationship or reference between one
+     * calendar component and another.value type: TEXT.
+     */
+    public final URI relatedTo = createProperty("relatedTo");
+
+    /**
+     * To specify the type of hierarchical relationship associated with the calendar
+     * component specified by the URI..
+     */
+    public final URI reltype = createProperty("reltype");
+
+    /**
+     * This URI defines the number of time the alarm should be repeated, after
+     * the initial trigger.value type: INTEGER.
+     */
+    public final URI repeat = createProperty("repeat");
+
+    /**
+     * value type: TEXTThis URI defines the status code returned for a scheduling
+     * request..
+     */
+    public final URI requestStatus = createProperty("requestStatus");
+
+    /**
+     * value type: TEXTThis URI defines the equipment or resources anticipated
+     * for an activity specified by a calendar entity...
+     */
+    public final URI resources = createProperty("resources");
+
+    /**
+     * To specify the participation role for the calendar user specified by the URI..
+     */
+    public final URI role = createProperty("role");
+
+    /**
+     * To specify whether there is an expectation of a favor of a reply from the
+     * calendar user specified by the URI value..
+     */
+    public final URI rsvp = createProperty("rsvp");
+
+    /**
+     * To specify the calendar user that is acting on behalf of the calendar user
+     * specified by the URI..
+     */
+    public final URI sentBy = createProperty("sentBy");
+
+    /**
+     * value type: integerThis URI defines the revision sequence number of the
+     * calendar component within a sequence of revisions..
+     */
+    public final URI sequence = createProperty("sequence");
+
+    /**
+     * value type: TEXTThis URI defines the overall status or confirmation for
+     * the calendar component..
+     */
+    public final URI status = createProperty("status");
+
+    /**
+     * This URI defines a short summary or subject for the calendar component.value
+     * type: TEXT.
+     */
+    public final URI summary = createProperty("summary");
+
+    /**
+     * This URI defines whether an event is transparent or not to busy time
+     * searches.value type: TEXT.
+     */
+    public final URI transp = createProperty("transp");
+
+    /**
+     * value type: TEXTTo specify the identifier for the time zone definition for
+     * a time component in the URI value.This URI specifies the text value
+     * that uniquely identifies the "VTIMEZONE" calendar component..
+     */
+    public final URI tzid = createProperty("tzid");
+
+    /**
+     * value type: TEXTThis URI specifies the customary designation for a time
+     * zone description..
+     */
+    public final URI tzname = createProperty("tzname");
+
+    /**
+     * value type: UTC-OFFSETThis URI specifies the offset which is in use prior
+     * to this time zone observance..
+     */
+    public final URI tzoffsetfrom = createProperty("tzoffsetfrom");
+
+    /**
+     * value type: UTC-OFFSETThis URI specifies the offset which is in use in
+     * this time zone observance..
+     */
+    public final URI tzoffsetto = createProperty("tzoffsetto");
+
+    /**
+     * This URI defines the persistent, globally unique identifier for the calendar
+     * component.value type: TEXT.
+     */
+    public final URI uid = createProperty("uid");
+
+    public final URI until = createProperty("until");
+
+    /**
+     * value type: TEXTThis URI specifies the identifier corresponding to the
+     * highest version number or the minimum and maximum range of the iCalendar specification
+     * that is required in order to interpret the iCalendar object..
+     */
+    public final URI version = createProperty("version");
+
+    private URI createClass(String string) {
+        return createClass(NS, string);
+    }
+
+    private URI createProperty(String string) {
+        return createProperty(NS, string);
+    }
+
+    private ICAL(){
+        super(NS);
+    }
+
+}

Added: incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/OGP.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/OGP.java?rev=1372269&view=auto
==============================================================================
--- incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/OGP.java (added)
+++ incubator/any23/trunk/api/src/main/java/org/apache/any23/vocab/OGP.java Mon Aug 13 06:15:29 2012
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.any23.vocab;
+
+import org.openrdf.model.URI;
+
+/**
+ * The <a href="http://ogp.me/">Open Graph Protocol</> vocabulary.
+ *
+ * @author Michele Mostarda (mostarda@fbk.eu)
+ */
+public class OGP extends Vocabulary {
+
+    public static final String NS = "http://ogp.me/ns#";
+    
+    /* BEGIN: Basic Metadata. */
+
+    /** The title of your object as it should appear within the graph (Facebook Graph API). */
+    public static final String TITLE = "title";
+    /** The type of your object, e.g., <code>video.movie</code>.
+     *  Depending on the type you specify, other properties may also be required. */
+    public static final String TYPE  = "type";
+    /** An image URL which should represent your object within the graph. */
+    public static final String URL   = "url";
+    /** The canonical URL of your object that will be used as its permanent ID in the graph (Facebook Graph API). */
+    public static final String IMAGE = "image";
+
+    /* END: Basic Metadata. */
+
+    /* BEGIN: Optional Metadata. */
+
+    /** A URL to an audio file to accompany this object. */
+    public static final String AUDIO = "audio";
+    /** A one to two sentence description of your object. */
+    public static final String DESCRIPTION = "description";
+    /** The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto).
+     *  If auto is chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank). */
+    public static final String DETERMINER = "determiner";
+    /** The locale these tags are marked up in. Of the format <code>language_TERRITORY</code>.
+     *  Default is <code>en_US</code>. */
+    public static final String LOCALE = "locale";
+    /** An array of other locales this page is available in. */
+    public static final String LOCALE__ALTERNATE = "locale:alternate";
+    /** If your object is part of a larger web site, the name which should be
+     *  displayed for the overall site. e.g., <b>IMDb</b>. */
+    public static final String SITE_NAME = "site_name";
+    /** A URL to a video file that complements this object. */
+    public static final String VIDEO = "video";
+
+    /* END: Optional Metadata. */
+
+    /* BEGIN: Structured Properties. */
+
+    /** Identical to <code>og:image</code>. */
+    public static final String IMAGE__URL        = "image:url";
+    /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
+    public static final String IMAGE__SECURE_URL = "image:secure_url";
+    /** A <i>MIME type</i> for this image. */
+    public static final String IMAGE__TYPE       = "image:type";
+    /** The number of pixels wide. */
+    public static final String IMAGE__WIDTH      = "image:width";
+    /** The number of pixels high. */
+    public static final String IMAGE__HEIGHT     = "image:height";
+
+    /** Video URL. */
+    public static final String VIDEO__URL        = "video:url";
+    /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
+    public static final String VIDEO__SECURE_URL = "video:secure_url";
+    /** A <i>MIME type</i> for this video. */
+    public static final String VIDEO__TYPE       = "video:type";
+    /** The number of pixels wide. */
+    public static final String VIDEO__WIDTH      = "video:width";
+    /** The number of pixels height. */
+    public static final String VIDEO__HEIGHT     = "video:height";
+
+    /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
+    public static final String AUDIO__SECURE_URL = "audio:secure_url";
+    /** A <i>MIME type</i> for this audio. */
+    public static final String AUDIO__TYPE       = "audio:type";
+
+    /* END: Structured Properties. */
+
+    private static OGP instance;
+
+    public static OGP getInstance() {
+        if(instance == null) {
+            instance = new OGP();
+        }
+        return instance;
+    }
+
+    public final URI NAMESPACE = createURI(NS);
+    
+
+    public final URI title           = createProperty(TITLE);
+    public final URI type            = createProperty(TYPE);
+    public final URI url             = createProperty(URL);
+    public final URI image           = createProperty(IMAGE);
+    public final URI description     = createProperty(DESCRIPTION);
+    public final URI determiner      = createProperty(DETERMINER);
+    public final URI locale          = createProperty(LOCALE);
+    public final URI localeAlternate = createProperty(LOCALE__ALTERNATE);
+    public final URI siteName        = createProperty(SITE_NAME);
+    public final URI video           = createProperty(VIDEO);
+
+    public final URI imageURL       = createProperty(IMAGE__URL);
+    public final URI imageSecureURL = createProperty(IMAGE__SECURE_URL);
+    public final URI imageType      = createProperty(IMAGE__TYPE);
+    public final URI imageWidth     = createProperty(IMAGE__WIDTH);
+    public final URI imageHeight    = createProperty(IMAGE__HEIGHT);
+
+    public final URI videoURL       = createProperty(VIDEO__URL);
+    public final URI videoSecureURL = createProperty(VIDEO__SECURE_URL);
+    public final URI videoType      = createProperty(VIDEO__TYPE);
+    public final URI videoWidth     = createProperty(VIDEO__WIDTH);
+    public final URI videoHeight    = createProperty(VIDEO__HEIGHT);
+
+    public final URI audio          = createProperty(AUDIO);
+    public final URI audioSecureURL = createProperty(AUDIO__SECURE_URL);
+    public final URI audioType      = createProperty(AUDIO__TYPE);
+
+    private URI createClass(String localName) {
+        return createClass(NS, localName);
+    }
+
+    private URI createProperty(String localName) {
+        return createProperty(NS, localName);
+    }
+
+    private OGP() {
+        super(NS);
+    }
+
+}



Mime
View raw message