Debian Codegraph @

wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/ValueConverter.java

raw
1 package org.wikidata.wdtk.rdf.values;
2
3 /*
4 * #%L
5 * Wikidata Toolkit RDF
6 * %%
7 * Copyright (C) 2014 Wikidata Toolkit Developers
8 * %%
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * #L%
21 */
22
23 import org.eclipse.rdf4j.model.Value;
24 import org.eclipse.rdf4j.rio.RDFHandlerException;
25 import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
26
27 /**
28 * Interface for classes that convert one type of Wikibase data value into a
29 * RDF.
30 *
31 * @author Markus Kroetzsch
32 *
33 * @param <V>
34 * the type of Wikibase value converted by this class
35 */
36 public interface ValueConverter<V extends org.wikidata.wdtk.datamodel.interfaces.Value> {
37
38 /**
39 * Returns an RDF value that should be used to represent the given Wikibase
40 * data value in RDF.
41 *
42 * @param value
43 * the value to convert
44 * @param propertyIdValue
45 * the property for which this value was used; this provides
46 * important context information for the conversion
47 * @param simple
48 * if true, use a simplified conversion to RDF and do not convert
49 * values that are inherently complex
50 * @return the RDF value to use for representing the data value in RDF
51 */
52 Value getRdfValue(V value, PropertyIdValue propertyIdValue, boolean simple);
53
54 /**
55 * Writes auxiliary triples that might be needed to encode a Wikibase value
56 * in RDF.
57 *
58 * @throws RDFHandlerException
59 * if there is a problem writing the triples
60 */
61 void writeAuxiliaryTriples() throws RDFHandlerException;
62 }