View Javadoc

1   /*
2    * Copyright 2015 Data Archiving and Networked Services (an institute of
3    * Koninklijke Nederlandse Akademie van Wetenschappen), King's College London,
4    * Georg-August-Universitaet Goettingen Stiftung Oeffentlichen Rechts
5    *
6    * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
7    * the European Commission - subsequent versions of the EUPL (the "Licence");
8    * You may not use this work except in compliance with the Licence.
9    * You may obtain a copy of the Licence at:
10   *
11   * https://joinup.ec.europa.eu/software/page/eupl
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the Licence is distributed on an "AS IS" basis,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the Licence for the specific language governing
17   * permissions and limitations under the Licence.
18   */
19  
20  package eu.ehri.project.importers.cvoc;
21  
22  import eu.ehri.project.exceptions.ValidationError;
23  import eu.ehri.project.importers.ImportLog;
24  import eu.ehri.project.importers.exceptions.InputParseError;
25  
26  import java.io.IOException;
27  import java.io.InputStream;
28  
29  
30  public interface SkosImporter {
31  
32      /**
33       * Import a file with a given log message.
34       *
35       * @param filePath   The file path
36       * @param logMessage A log message
37       * @return An import log
38       */
39      ImportLog importFile(String filePath, String logMessage)
40              throws IOException, InputParseError, ValidationError;
41  
42      /**
43       * Import an input stream with a given log message.
44       *
45       * @param ios        The input stream
46       * @param logMessage A log message
47       * @return An import log
48       */
49      ImportLog importFile(InputStream ios, String logMessage)
50              throws IOException, InputParseError, ValidationError;
51  
52      /**
53       * Switch the importer mode to one that is tolerant
54       * of individual item validation errors.
55       *
56       * @param tolerant Allow individual items to error
57       * @return A new SKOS importer with the given tolerance mode
58       */
59      SkosImporter setTolerant(boolean tolerant);
60  
61      /**
62       * Set the URI prefix for items created by the importer.
63       *
64       * @param prefix a URI prefix
65       * @return A new SKOS importer with the given prefix
66       */
67      SkosImporter setBaseURI(String prefix);
68  
69      /**
70       * Set the URI suffix for items created by the importer.
71       *
72       * @param suffix a URI suffix
73       * @return A new SKOS importer with the given suffix
74       */
75      SkosImporter setURISuffix(String suffix);
76  
77      /**
78       * Set the RDF format. Supported values are: N3, TTL, TURTLE,
79       * and the default, RDF/XML.
80       *
81       * @param format The RDF format string.
82       * @return A new SKOS importer with the given format
83       */
84      SkosImporter setFormat(String format);
85  
86      /**
87       * Set default language for literals without a lang suffix.
88       *
89       * @param lang A two- or three-letter language code
90       * @return A new SKOS importer with the given default language
91       */
92      SkosImporter setDefaultLang(String lang);
93  }