Skip to content

Commit b657b6a

Browse files
author
Pham Minh Duc
committed
Distinguish Tags and Places
1 parent 0a47e8b commit b657b6a

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

src/main/java/ldbc/snb/datagen/serializer/Turtle.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static String getNamespaces() {
1313
createPrefixLine(result, RDFS.PREFIX, RDFS.NAMESPACE);
1414
createPrefixLine(result, XSD.PREFIX, XSD.NAMESPACE);
1515
createPrefixLine(result, SNVOC.PREFIX, SNVOC.NAMESPACE);
16+
createPrefixLine(result, SNTAG.PREFIX, SNTAG.NAMESPACE);
1617
createPrefixLine(result, SN.PREFIX, SN.NAMESPACE);
1718
createPrefixLine(result, DBP.PREFIX, DBP.NAMESPACE);
1819
return result.toString();

src/main/java/ldbc/snb/datagen/serializer/snb/interactive/TurtleInvariantSerializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ protected void serialize(final TagClass tagClass) {
113113

114114
protected void serialize(final Tag tag) {
115115
StringBuffer result = new StringBuffer(350);
116-
Turtle.writeDBPData(writers[FileNames.SOCIAL_NETWORK.ordinal()],DBP.fullPrefixed(tag.name), FOAF.Name, Turtle.createLiteral(tag.name));
116+
Turtle.writeDBPData(writers[FileNames.SOCIAL_NETWORK.ordinal()],SNTAG.fullPrefixed(tag.name), FOAF.Name, Turtle.createLiteral(tag.name));
117117
Integer tagClass = tag.tagClass;
118-
Turtle.writeDBPData(writers[FileNames.SOCIAL_NETWORK.ordinal()],DBP.fullPrefixed(tag.name), RDF.type, SN.getTagClassURI(tagClass));
119-
Turtle.createTripleSPO(result, DBP.fullPrefixed(tag.name), SNVOC.id,
118+
Turtle.writeDBPData(writers[FileNames.SOCIAL_NETWORK.ordinal()],SNTAG.fullPrefixed(tag.name), RDF.type, SN.getTagClassURI(tagClass));
119+
Turtle.createTripleSPO(result, SNTAG.fullPrefixed(tag.name), SNVOC.id,
120120
Turtle.createDataTypeLiteral(Long.toString(tag.id), XSD.Int));
121121
writers[FileNames.SOCIAL_NETWORK.ordinal()].write(result.toString());
122122
}

src/main/java/ldbc/snb/datagen/serializer/snb/interactive/TurtlePersonSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected void serialize(final Person p) {
132132

133133
for(Integer tag : p.interests()) {
134134
String interest = Dictionaries.tags.getName(tag);
135-
Turtle.createTripleSPO(result, prefix, SNVOC.hasInterest, DBP.fullPrefixed(interest));
135+
Turtle.createTripleSPO(result, prefix, SNVOC.hasInterest, SNTAG.fullPrefixed(interest));
136136
}
137137
writers[FileNames.SOCIAL_NETWORK.ordinal()].write(result.toString());
138138
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2013 LDBC
3+
* Linked Data Benchmark Council (http://ldbc.eu)
4+
*
5+
* This file is part of ldbc_socialnet_dbgen.
6+
*
7+
* ldbc_socialnet_dbgen is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* ldbc_socialnet_dbgen is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with ldbc_socialnet_dbgen. If not, see <http://www.gnu.org/licenses/>.
19+
*
20+
* Copyright (C) 2011 OpenLink Software <[email protected]>
21+
* All Rights Reserved.
22+
*
23+
* This program is free software; you can redistribute it and/or modify
24+
* it under the terms of the GNU General Public License as published by
25+
* the Free Software Foundation; only Version 2 of the License dated
26+
* June 1991.
27+
*
28+
* This program is distributed in the hope that it will be useful,
29+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
30+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31+
* GNU General Public License for more details.
32+
*
33+
* You should have received a copy of the GNU General Public License
34+
* along with this program; if not, write to the Free Software
35+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36+
*/
37+
package ldbc.snb.datagen.vocabulary;
38+
39+
/**
40+
* LDBC social network vocabulary namespace used in the serialization process.
41+
*/
42+
public class SNTAG {
43+
44+
public static final String NAMESPACE = "http://www.ldbc.eu/ldbc_socialnet/1.0/tag/";
45+
public static final String PREFIX = "sntag:";
46+
47+
48+
/**
49+
* Gets the LDBC social network vocabulary prefix version of the input.
50+
*/
51+
public static String prefixed(String string) {
52+
return PREFIX + string;
53+
}
54+
55+
/**
56+
* Gets the LDBC social network vocabulary URL version of the input.
57+
*/
58+
public static String getUrl(String string) {
59+
return NAMESPACE + string;
60+
}
61+
62+
/**
63+
* Gets the LDBC social network vocabulary RDF-URL version of the input.
64+
*/
65+
public static String fullPrefixed(String string) {
66+
return "<" + NAMESPACE + string + ">";
67+
}
68+
}

0 commit comments

Comments
 (0)