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      /** The type of your object, e.g., "video.movie". Depending on the 
41       * type you specify, other properties may also be required. */
42      public static final String TYPE  = "type";
43  
44      /** The canonical URL of your object that will be used as its permanent ID in the 
45       * graph, e.g., "http://www.imdb.com/title/tt0117500/". */
46      public static final String URL   = "url";
47  
48      /** An image URL which should represent your object within the graph. */
49      public static final String IMAGE = "image";
50  
51      /* END: Basic Metadata. */
52  
53      /* BEGIN: Optional Metadata. */
54  
55      /** A URL to an audio file to accompany this object. */
56      public static final String AUDIO = "audio";
57  
58      /** A one to two sentence description of your object. */
59      public static final String DESCRIPTION = "description";
60  
61      /** The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto).
62       *  If auto is chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank). */
63      public static final String DETERMINER = "determiner";
64  
65      /** The locale these tags are marked up in. Of the format <code>language_TERRITORY</code>.
66       *  Default is <code>en_US</code>. */
67      public static final String LOCALE = "locale";
68  
69      /** An array of other locales this page is available in. */
70      public static final String LOCALE__ALTERNATE = "locale:alternate";
71  
72      /** If your object is part of a larger web site, the name which should be
73       *  displayed for the overall site. e.g., <b>IMDb</b>. */
74      public static final String SITE_NAME = "site_name";
75  
76      /** A URL to a video file that complements this object. */
77      public static final String VIDEO = "video";
78  
79      /* END: Optional Metadata. */
80  
81      /* BEGIN: Structured Properties. */
82  
83      /** Identical to <code>og:image</code>. */
84      public static final String IMAGE__URL        = "image:url";
85  
86      /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
87      public static final String IMAGE__SECURE_URL = "image:secure_url";
88  
89      /** A <i>MIME type</i> for this image. */
90      public static final String IMAGE__TYPE       = "image:type";
91  
92      /** The number of pixels wide. */
93      public static final String IMAGE__WIDTH      = "image:width";
94  
95      /** The number of pixels high. */
96      public static final String IMAGE__HEIGHT     = "image:height";
97  
98      /** A description of what is in the image (not a caption). 
99       * If the page specifies an og:image it should specify og:image:alt.*/
100     public static final String IMAGE__ALT        = "image:alt";
101 
102     /** Video URL. */
103     public static final String VIDEO__URL        = "video:url";
104 
105     /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
106     public static final String VIDEO__SECURE_URL = "video:secure_url";
107 
108     /** A <i>MIME type</i> for this video. */
109     public static final String VIDEO__TYPE       = "video:type";
110 
111     /** The number of pixels wide. */
112     public static final String VIDEO__WIDTH      = "video:width";
113 
114     /** The number of pixels height. */
115     public static final String VIDEO__HEIGHT     = "video:height";
116 
117     /** A description of what is in the video (not a caption). 
118      * If the page specifies an og:video it should specify og:video:alt.*/
119     public static final String VIDEO__ALT        = "video:alt";
120 
121     /** An alternate url to use if the webpage requires <b>HTTPS</b>. */
122     public static final String AUDIO__SECURE_URL = "audio:secure_url";
123 
124     /** A <i>MIME type</i> for this audio. */
125     public static final String AUDIO__TYPE       = "audio:type";
126 
127     /** A description of what is in the audio file (not a caption). 
128      * If the page specifies an og:audio it should specify og:audio:alt.*/
129     public static final String AUDIO__ALT        = "audio:alt";
130 
131     /* END: Structured Properties. */
132 
133     private static OGP instance;
134 
135     public static OGP getInstance() {
136         if(instance == null) {
137             instance = new OGP();
138         }
139         return instance;
140     }
141 
142     public final IRI NAMESPACE = createIRI(NS);
143     
144 
145     public final IRI title           = createProperty(TITLE);
146     public final IRI type            = createProperty(TYPE);
147     public final IRI url             = createProperty(URL);
148     public final IRI image           = createProperty(IMAGE);
149     public final IRI description     = createProperty(DESCRIPTION);
150     public final IRI determiner      = createProperty(DETERMINER);
151     public final IRI locale          = createProperty(LOCALE);
152     public final IRI localeAlternate = createProperty(LOCALE__ALTERNATE);
153     public final IRI siteName        = createProperty(SITE_NAME);
154     public final IRI video           = createProperty(VIDEO);
155 
156     public final IRI imageURL       = createProperty(IMAGE__URL);
157     public final IRI imageSecureURL = createProperty(IMAGE__SECURE_URL);
158     public final IRI imageType      = createProperty(IMAGE__TYPE);
159     public final IRI imageWidth     = createProperty(IMAGE__WIDTH);
160     public final IRI imageHeight    = createProperty(IMAGE__HEIGHT);
161     public final IRI imageAlt       = createProperty(IMAGE__ALT);
162 
163     public final IRI videoURL       = createProperty(VIDEO__URL);
164     public final IRI videoSecureURL = createProperty(VIDEO__SECURE_URL);
165     public final IRI videoType      = createProperty(VIDEO__TYPE);
166     public final IRI videoWidth     = createProperty(VIDEO__WIDTH);
167     public final IRI videoHeight    = createProperty(VIDEO__HEIGHT);
168     public final IRI videoAlt       = createProperty(VIDEO__ALT);
169 
170     public final IRI audio          = createProperty(AUDIO);
171     public final IRI audioSecureURL = createProperty(AUDIO__SECURE_URL);
172     public final IRI audioType      = createProperty(AUDIO__TYPE);
173     public final IRI audioAlt       = createProperty(AUDIO__ALT);
174 
175     @SuppressWarnings("unused")
176     private IRI createClass(String localName) {
177         return createClass(NS, localName);
178     }
179 
180     private IRI createProperty(String localName) {
181         return createProperty(NS, localName);
182     }
183 
184 }