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   * This vocabulary models the structure of a <i>CSV</i> file according the
24   * <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 a row.
44       */
45      public final IRI row = createProperty(ROW);
46  
47      /**
48       * This property expresses the index of a row in a <i>CSV</i> file.
49       */
50      public final IRI rowPosition = createProperty(ROW_POSITION);
51  
52      /**
53       * This property expresses the number of rows in a <i>CSV</i> file.
54       */
55      public final IRI numberOfRows = createProperty(NUMBER_OF_ROWS);
56  
57      /**
58       * This property expresses the number of columns in a <i>CSV</i> file.
59       */
60      public final IRI numberOfColumns = createProperty(NUMBER_OF_COLUMNS);
61  
62      /**
63       * This resource identifies a <i>Row</i>.
64       */
65      public final IRI rowType = createResource(ROW_TYPE);
66  
67      /**
68       * This property expresses the index of a column in a <i>CSV</i> file.
69       */
70      public final IRI columnPosition = createProperty(COLUMN_POSITION);
71  
72      /**
73       * The namespace of the vocabulary as a string.
74       */
75      public static final String NS = "http://tools.ietf.org/html/rfc4180";
76  
77      private static CSV instance;
78  
79      private CSV() {
80          super(NS);
81      }
82  
83      public static CSV getInstance() {
84          if (instance == null) {
85              instance = new CSV();
86          }
87          return instance;
88      }
89  
90      public IRI createResource(String localName) {
91          return createProperty(NS, localName);
92      }
93  
94      /**
95       *
96       * @param localName
97       *            name to assign to namespace.
98       * 
99       * @return the new URI instance.
100      */
101     public IRI createProperty(String localName) {
102         return createProperty(NS, localName);
103     }
104 
105 }