View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *  http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.any23.vocab;
19  
20  import org.eclipse.rdf4j.model.IRI;
21  
22  /**
23   * The <a href="http://ogp.me/">Open Graph Protocol</a> vocabulary.
24   *
25   * @author Michele Mostarda (mostarda@fbk.eu)
26   */
27  public class OGP extends Vocabulary {
28  
29      private OGP() {
30          super(NS);
31      }
32  
33      public static final String NS = "http://ogp.me/ns#";
34  
35      /* BEGIN: Basic Metadata. */
36  
37      /** The title of your object as it should appear within the graph, e.g., "The Rock". */
38      public static final String TITLE = "title";
39  
40      /**
41       * The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be
42       * required.
43       */
44      public static final String TYPE = "type";
45  
46      /**
47       * The canonical URL of your object that will be used as its permanent ID in the graph, e.g.,
48       * "http://www.imdb.com/title/tt0117500/".
49       */
50      public static final String URL = "url";
51  
52      /** An image URL which should represent your object within the graph. */
53      public static final String IMAGE = "image";
54  
55      /* END: Basic Metadata. */
56  
57      /* BEGIN: Optional Metadata. */
58  
59      /** A URL to an audio file to accompany this object. */
60      public static final String AUDIO = "audio";
61  
62      /** A one to two sentence description of your object. */
63      public static final String DESCRIPTION = "description";
64  
65      /**
66       * The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto). If auto is
67       * chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank).
68       */
69      public static final String DETERMINER = "determiner";
70  
71      /**
72       * The locale these tags are marked up in. Of the format <code>language_TERRITORY</code>. Default is
73       * <code>en_US</code>.
74       */
75      public static final String LOCALE = "locale";
76  
77      /** An array of other locales this page is available in. */
78      public static final String LOCALE__ALTERNATE = "locale:alternate";
79  
80      /**
81       * If your object is part of a larger web site, the name which should be displayed for the overall site. e.g.,
82       * <b>IMDb</b>.
83       */
84      public static final String SITE_NAME = "site_name";
85  
86      /** A URL to a video file that complements this object. */
87      public static final String VIDEO = "video";
88  
89      /* END: Optional Metadata. */
90  
91      /* BEGIN: Structured Properties. */
92  
93      /** Identical to <code>og:image</code>. */
94      public static final String IMAGE__URL = "image:url";
95  
96      /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
97      public static final String IMAGE__SECURE_URL = "image:secure_url";
98  
99      /** A <i>MIME type</i> for this image. */
100     public static final String IMAGE__TYPE = "image:type";
101 
102     /** The number of pixels wide. */
103     public static final String IMAGE__WIDTH = "image:width";
104 
105     /** The number of pixels high. */
106     public static final String IMAGE__HEIGHT = "image:height";
107 
108     /**
109      * A description of what is in the image (not a caption). If the page specifies an og:image it should specify
110      * og:image:alt.
111      */
112     public static final String IMAGE__ALT = "image:alt";
113 
114     /** Video URL. */
115     public static final String VIDEO__URL = "video:url";
116 
117     /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
118     public static final String VIDEO__SECURE_URL = "video:secure_url";
119 
120     /** A <i>MIME type</i> for this video. */
121     public static final String VIDEO__TYPE = "video:type";
122 
123     /** The number of pixels wide. */
124     public static final String VIDEO__WIDTH = "video:width";
125 
126     /** The number of pixels height. */
127     public static final String VIDEO__HEIGHT = "video:height";
128 
129     /**
130      * A description of what is in the video (not a caption). If the page specifies an og:video it should specify
131      * og:video:alt.
132      */
133     public static final String VIDEO__ALT = "video:alt";
134 
135     /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
136     public static final String AUDIO__SECURE_URL = "audio:secure_url";
137 
138     /** A <i>MIME type</i> for this audio. */
139     public static final String AUDIO__TYPE = "audio:type";
140 
141     /**
142      * A description of what is in the audio file (not a caption). If the page specifies an og:audio it should specify
143      * og:audio:alt.
144      */
145     public static final String AUDIO__ALT = "audio:alt";
146 
147     /* END: Structured Properties. */
148 
149     private static OGP instance;
150 
151     public static OGP getInstance() {
152         if (instance == null) {
153             instance = new OGP();
154         }
155         return instance;
156     }
157 
158     public final IRI NAMESPACE = createIRI(NS);
159 
160     public final IRI title = createProperty(TITLE);
161     public final IRI type = createProperty(TYPE);
162     public final IRI url = createProperty(URL);
163     public final IRI image = createProperty(IMAGE);
164     public final IRI description = createProperty(DESCRIPTION);
165     public final IRI determiner = createProperty(DETERMINER);
166     public final IRI locale = createProperty(LOCALE);
167     public final IRI localeAlternate = createProperty(LOCALE__ALTERNATE);
168     public final IRI siteName = createProperty(SITE_NAME);
169     public final IRI video = createProperty(VIDEO);
170 
171     public final IRI imageURL = createProperty(IMAGE__URL);
172     public final IRI imageSecureURL = createProperty(IMAGE__SECURE_URL);
173     public final IRI imageType = createProperty(IMAGE__TYPE);
174     public final IRI imageWidth = createProperty(IMAGE__WIDTH);
175     public final IRI imageHeight = createProperty(IMAGE__HEIGHT);
176     public final IRI imageAlt = createProperty(IMAGE__ALT);
177 
178     public final IRI videoURL = createProperty(VIDEO__URL);
179     public final IRI videoSecureURL = createProperty(VIDEO__SECURE_URL);
180     public final IRI videoType = createProperty(VIDEO__TYPE);
181     public final IRI videoWidth = createProperty(VIDEO__WIDTH);
182     public final IRI videoHeight = createProperty(VIDEO__HEIGHT);
183     public final IRI videoAlt = createProperty(VIDEO__ALT);
184 
185     public final IRI audio = createProperty(AUDIO);
186     public final IRI audioSecureURL = createProperty(AUDIO__SECURE_URL);
187     public final IRI audioType = createProperty(AUDIO__TYPE);
188     public final IRI audioAlt = createProperty(AUDIO__ALT);
189 
190     @SuppressWarnings("unused")
191     private IRI createClass(String localName) {
192         return createClass(NS, localName);
193     }
194 
195     private IRI createProperty(String localName) {
196         return createProperty(NS, localName);
197     }
198 
199 }