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.openrdf.model.URI;
21  
22  /**
23   * This vocabulary models the structure of a <i>CSV</i> file
24   * according the <a href="http://www.ietf.org/rfc/rfc4180.txt">RFC 4180</a>.
25   *
26   * @author Davide Palmisano (dpalmisano@gmail.com)
27   */
28  public class CSV extends Vocabulary {
29  
30      public static final String ROW = "row";
31  
32      public static final String ROW_POSITION= "rowPosition";
33  
34      public static final String NUMBER_OF_ROWS = "numberOfRows";
35  
36      public static final String NUMBER_OF_COLUMNS = "numberOfColumns";
37  
38      public static final String COLUMN_POSITION= "columnPosition";
39  
40      public static final String ROW_TYPE = "Row";
41  
42      /**
43       * This property links the identifier of a <i>CSV</i> to an entity representing
44       * a row.
45       */
46      public final URI row = createProperty(ROW);
47  
48      /**
49       * This property expresses the index of a row in a <i>CSV</i> file.
50       */
51      public final URI rowPosition = createProperty(ROW_POSITION);
52  
53      /**
54       * This property expresses the number of rows in a <i>CSV</i> file.
55       */
56      public final URI numberOfRows = createProperty(NUMBER_OF_ROWS);
57  
58      /**
59       * This property expresses the number of columns in a <i>CSV</i> file.
60       */
61      public final URI numberOfColumns = createProperty(NUMBER_OF_COLUMNS);
62  
63      /**
64       * This resource identifies a <i>Row</i>.
65       */
66      public final URI rowType = createResource(ROW_TYPE);
67  
68      /**
69       * This property expresses the index of a column in a <i>CSV</i> file.
70       */
71      public URI columnPosition = createProperty(COLUMN_POSITION);
72  
73      /**
74       * The namespace of the vocabulary as a string.
75       */
76      public static final String NS = "http://vocab.sindice.net/csv/";
77  
78      private static CSV instance;
79  
80      public static CSV getInstance() {
81          if (instance == null) {
82              instance = new CSV();
83          }
84          return instance;
85      }
86  
87      public URI createResource(String localName) {
88          return createProperty(NS, localName);
89      }
90  
91      /**
92       *
93       * @param localName
94       * @return the new URI instance.
95       */
96      public URI createProperty(String localName) {
97          return createProperty(NS, localName);
98      }
99  
100     private CSV() {
101         super(NS);
102     }
103 
104 }