-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathStdJoinCondition.java
More file actions
101 lines (85 loc) · 3.12 KB
/
StdJoinCondition.java
File metadata and controls
101 lines (85 loc) · 3.12 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
/*
* 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 : Standard Join Condition Class
*
* A join condition is a resource that has
* exactly two properties:
* - rr:child, whose value is known as the
* join condition's child column
* - rr:parent, whose value is known as the
* join condition's parent column
*
****************************************************************************/
package be.ugent.mmlab.rml.model;
import net.antidot.semantic.rdf.rdb2rdf.r2rml.exception.InvalidR2RMLStructureException;
import net.antidot.semantic.rdf.rdb2rdf.r2rml.exception.InvalidR2RMLSyntaxException;
import net.antidot.sql.model.tools.SQLDataValidator;
public class StdJoinCondition implements JoinCondition {
private String child;
private String parent;
private String guard;
public StdJoinCondition(String child, String parent,String guard)
throws InvalidR2RMLStructureException, InvalidR2RMLSyntaxException {
setChild(child);
setParent(parent);
setGuard(guard);
}
private void setParent(String parent)
throws InvalidR2RMLStructureException, InvalidR2RMLSyntaxException {
if (parent == null)
throw new InvalidR2RMLStructureException(
"[StdJoinCondition:setParent] A join condition must "
+ "have a parent column name.");
// old code
// if (!SQLDataValidator.isValidSQLIdentifier(parent))
// throw new InvalidR2RMLSyntaxException(
// "[StdJoinCondition:setParent] Not a valid column "
// + "value : " + parent);
// TODO check if reference is valid
this.parent = parent;
}
private void setChild(String child) throws InvalidR2RMLStructureException,
InvalidR2RMLSyntaxException {
if (child == null)
throw new InvalidR2RMLStructureException(
"[StdJoinCondition:construct] A join condition must "
+ "have a child column name.");
// old code
// if (!SQLDataValidator.isValidSQLIdentifier(child))
// throw new InvalidR2RMLSyntaxException(
// "[StdJoinCondition:setParent] Not a valid column "
// + "value : " + child);
// TODO check if reference is valid
this.child = child;
}
public String getChild() {
return child;
}
public String getParent() {
return parent;
}
public String getGuard(){
return guard;
}
private void setGuard(String guard) {
if (guard != null)
this.guard=guard;
}
}