001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.marshall.jena;
018
019import static java.lang.annotation.ElementType.*;
020import static java.lang.annotation.RetentionPolicy.*;
021
022import java.lang.annotation.*;
023
024/**
025 * Identifies the default RDF namespaces at the package level.
026 *
027 * <h5 class='section'>See Also:</h5><ul>
028 *    <li class='link'>{doc jmr.RdfDetails}
029
030 * </ul>
031 */
032@Documented
033@Target(PACKAGE)
034@Retention(RUNTIME)
035@Inherited
036public @interface RdfSchema {
037
038   /**
039    * Sets the default RDF namespace URL for all classes in this and child packages.
040    *
041    * <p>
042    * Must either be matched with a {@link #prefix()} annotation, or an {@link #rdfNs()} mapping with the same
043    * {@link RdfNs#namespaceURI() @RdfNs(namespaceURI)} value.
044    *
045    * @return The annotation value.
046    */
047   public String namespace() default "";
048
049   /**
050    * Sets the default RDF prefix for all classes in this and child packages.
051    *
052    * <p>
053    * Must either be matched with a {@link #namespace()} annotation, or an {@link #rdfNs()} mapping with the same
054    * {@link RdfNs#prefix} value.
055    *
056    * @return The annotation value.
057    */
058   public String prefix() default "";
059
060   /**
061    * Lists all namespace mappings to be used on all classes within this package.
062    *
063    * <p>
064    * The purpose of this annotation is to allow namespace mappings to be defined in a single location and referred to
065    * by name through just the {@link Rdf#prefix() @Rdf(prefix)} annotation.
066    *
067    * <p>
068    * Inherited by child packages.
069    *
070    * <h5 class='section'>Example:</h5>
071    *
072    * Contents of <c>package-info.java</c>...
073    * <p class='bjava'>
074    *    <jc>// XML namespaces used within this package.</jc>
075    *    <ja>@RdfSchema</ja>(prefix=<js>"ab"</js>,
076    *       namespaces={
077    *          <ja>@RdfNs</ja>(prefix=<js>"ab"</js>, namespaceURI=<js>"http://www.apache.org/addressBook/"</js>),
078    *          <ja>@RdfNs</ja>(prefix=<js>"per"</js>, namespaceURI=<js>"http://www.apache.org/person/"</js>),
079    *          <ja>@RdfNs</ja>(prefix=<js>"addr"</js>, namespaceURI=<js>"http://www.apache.org/address/"</js>),
080    *          <ja>@RdfNs</ja>(prefix=<js>"mail"</js>, namespaceURI="<js>http://www.apache.org/mail/"</js>)
081    *       }
082    *    )
083    *    <jk>package</jk> org.apache.juneau.marshall.examples.addressbook;
084    *    <jk>import</jk> org.apache.juneau.marshall.jena.*;
085    * </p>
086    *
087    * <p>
088    * Class in package using defined namespaces...
089    * <p class='bjava'>
090    *    <jk>package</jk> org.apache.juneau.marshall.examples.addressbook;
091    *
092    *    <jc>// Bean class, override "ab" namespace on package.</jc>
093    *    <ja>@Rdf</ja>(prefix=<js>"addr"</js>)
094    *    <jk>public class</jk> Address {
095    *
096    *       <jc>// Bean property, use "addr" namespace on class.</jc>
097    *       <jk>public int</jk> <jf>id</jf>;
098    *
099    *       <jc>// Bean property, override with "mail" namespace.</jc>
100    *       <ja>@Rdf</ja>(prefix=<js>"mail"</js>)
101    *       <jk>public</jk> String <jf>street</jf>, <jf>city</jf>, <jf>state</jf>;
102    *    }
103    * </p>
104    *
105    * @return The annotation value.
106    */
107   public RdfNs[] rdfNs() default {};
108}