-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTermMap.java
More file actions
170 lines (147 loc) · 5.91 KB
/
TermMap.java
File metadata and controls
170 lines (147 loc) · 5.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Copyright 2011 Antidot opensource@antidot.net
* https://github.com/antidot/db2triples
*
* DB2Triples is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* DB2Triples is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
*
* R2RML Model : TermMap Interface
*
* A term map is a function that generates an RDF term
* from a logical source expression. The result of that function
* is known as the term map's generated RDF term.
* Modified by mielvandersande
****************************************************************************/
package be.ugent.mmlab.rml.model;
import be.ugent.mmlab.rml.model.reference.ReferenceIdentifier;
import java.util.Set;
import net.antidot.semantic.xmls.xsd.XSDLexicalTransformation;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
public interface TermMap {
/**
* A term map must be exactly one of the following types.
*/
public enum TermMapType {
// A constant-valued term map is a term map that ignores the logical
// table row and always generates the same RDF term
CONSTANT_VALUED,
// A reference-valued term map is a term map that is represented by a
// resource that has exactly one rml:reference or rr:column property.
REFERENCE_VALUED,
// A template-valued term map is a term map that is represented by a
// resource that has exactly one rr:template property
TEMPLATE_VALUED,
// In db2triples and contrary to the R2RML norm, we accepts
// auto-assignments of blank nodes.
NO_VALUE_FOR_BNODE
}
public TermMapType getTermMapType();
/**
* The referenced columns of a term map are the set of references
* referenced in the term map and depend on the type of term map.
*/
public Set<ReferenceIdentifier> getReferencedSelectors();
/**
* The constant value of a constant-valued term map is the RDF term that is
* the value of its rr:constant property. Only if CONSTANT_VALUED type.
*/
public Value getConstantValue();
/**
* The column value of the term map is the data value of that column in a
* given logical table row. Only if REFERENCE_VALUED type.
*/
public ReferenceIdentifier getReferenceValue();
/**
* The value of the rr:template property MUST be a valid string template. A
* string template is a format string that can be used to build strings from
* multiple components. It can reference column names by enclosing them in
* curly braces. Only if TEMPLATE_VALUED type.
*/
public String getStringTemplate();
public String getStringGuard();
/**
* If the term map has an optional rr:termType property, then its term type
* is the value of that property.
*/
public TermType getTermType();
/**
* A term map with a term type of rr:Literal MAY have a specified language
* tag. It must be valid too.
*/
public String getLanguageTag();
/**
* A typeable term map is a term map with a term type of rr:Literal that
* does not have a specified language tag.
*/
public boolean isTypeable();
/**
* Typeable term maps may generate typed literals. The datatype of these
* literals can be explicitly specified using rr:datatype.
*/
public URI getDataType();
/**
* A typeable term map has an implicit datatype. If the term map is a
* column-valued term map, then the implicit datatype is the corresponding
* RDF datatype of the respective column in the logical table row.
* Otherwise, the term map must be a template-valued term map and its
* implicit datatype is empty
*/
public URI getImplicitDataType();
/**
* A datatype override is in effect on a typeable term map if it has a
* specified datatype, and the specified datatype is different from its
* implicit datatype.
*/
public boolean isOveridden();
/**
* A typeable term map has an implicit datatype and an implicit transform.
*/
public XSDLexicalTransformation.Transformation getImplicitTransformation();
/**
* An inverse expression is a string template associated with a
* column-valued term map or template-value term map. It is represented by
* the value of the rr:inverseExpression property.
*
* Inverse expressions are useful for optimizing term maps that reference
* derived columns in R2RML views.
*
* An inverse expression MUST satisfy some conditions. (see ref.)
*/
public String getInverseExpression();
/*
*
* See what we do with this underneath!!!!!!!
*
*/
/**
* @throws UnsupportedEncodingException
* @throws SQLException
* @throws R2RMLDataError
* The generated RDF term of a term map for a given logical table row is
* determined as follows: If the term map is a constant-valued term map,
* then the generated RDF term is the term map's constant value. If the term
* map is a column-valued term map, then the generated RDF term is
* determined by applying the term generation rules to its column value. If
* the term map is a template-valued term map, then the generated RDF term
* is determined by applying the term generation rules to its template
* value.
*
* @param dbValues
* @return
* @throws
*/
//public String getValue(Map<ColumnIdentifier, byte[]> dbValues, ResultSetMetaData dbTypes) throws R2RMLDataError, SQLException, UnsupportedEncodingException;
}