Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/LocalConceptStoreSchema.java |
— | — | @@ -65,6 +65,8 @@ |
66 | 66 | |
67 | 67 | resourceTable = new EntityTable(this, "resource", getDefaultTableAttributes()); |
68 | 68 | resourceTable.addField( new DatabaseField(this, "id", "INT", "AUTO_INCREMENT", true, KeyType.PRIMARY ) ); |
| 69 | + resourceTable.addField( new DatabaseField(this, "page_id", "INT", null, false, KeyType.UNIQUE ) ); |
| 70 | + resourceTable.addField( new DatabaseField(this, "revision_id", "INT", null, false, KeyType.UNIQUE ) ); |
69 | 71 | //resourceTable.addField( new ReferenceField(this, "corpus", "INT", null, true, null, "corpus", "id", null ) ); |
70 | 72 | resourceTable.addField( new DatabaseField(this, "name", getTextType(255), null, true, KeyType.UNIQUE ) ); |
71 | 73 | resourceTable.addField( new DatabaseField(this, "type", "INT", null, true, KeyType.INDEX ) ); //TODO: enum |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/processor/AbstractPageProcessor.java |
— | — | @@ -17,6 +17,7 @@ |
18 | 18 | import de.brightbyte.util.SystemUtils; |
19 | 19 | import de.brightbyte.wikiword.NamespaceSet; |
20 | 20 | import de.brightbyte.wikiword.ResourceType; |
| 21 | +import de.brightbyte.wikiword.RevisionInfo; |
21 | 22 | import de.brightbyte.wikiword.TweakSet; |
22 | 23 | import de.brightbyte.wikiword.analyzer.AnalyzerUtils; |
23 | 24 | import de.brightbyte.wikiword.analyzer.WikiPage; |
— | — | @@ -125,10 +126,13 @@ |
126 | 127 | } |
127 | 128 | */ |
128 | 129 | |
129 | | - public void handlePage(int id, int namespace, String title, String text, Date timestamp) throws IOException, PersistenceException { |
| 130 | + public void handlePage(RevisionInfo revision, String text) throws IOException, PersistenceException { |
| 131 | + int id = revision.getPageId(); |
| 132 | + String title = revision.getPageTitle(); |
| 133 | + |
130 | 134 | if (stoplist!=null) { |
131 | 135 | if (stoplist.set(id, true)) { |
132 | | - out.warn("WARNING: ignored dupe: #"+id+" "+namespace+":"+title); |
| 136 | + out.warn("WARNING: ignored dupe: #"+revision.getPageId()+" "+revision.getPageTitle()); |
133 | 137 | return; |
134 | 138 | } |
135 | 139 | } |
— | — | @@ -158,7 +162,7 @@ |
159 | 163 | bulkTracker.step(text.length()); |
160 | 164 | memoryTracker.step(); |
161 | 165 | |
162 | | - int rcId = importPage(namespace, title, text, timestamp); |
| 166 | + int rcId = importPage(revision, text); |
163 | 167 | if (rcId>0) lastRcId = rcId; |
164 | 168 | |
165 | 169 | progressTicks++; |
— | — | @@ -214,20 +218,20 @@ |
215 | 219 | return true; |
216 | 220 | } |
217 | 221 | |
218 | | - protected final int importPage(int namespace, String title, String text, Date timestamp) throws PersistenceException { |
219 | | - WikiPage page = analyzer.makePage(namespace, title, text, forceTitleCase); |
| 222 | + protected final int importPage(RevisionInfo revision, String text) throws PersistenceException { |
| 223 | + WikiPage page = analyzer.makePage(revision.getNamespace(), revision.getPageTitle(), text, forceTitleCase); |
220 | 224 | |
221 | 225 | //TODO: check if page is stored. if up to date, skip. if older, update. if missing, create. optionally force update. |
222 | 226 | |
223 | 227 | if (!isRelevant(page)) { |
224 | | - out.trace("ignored page "+title+" in namespace "+namespace); |
| 228 | + out.trace("ignored page "+revision.getPageTitle()+" in namespace "+revision.getNamespace()); |
225 | 229 | return -1; |
226 | 230 | } |
227 | 231 | |
228 | | - return importPage(page, timestamp); |
| 232 | + return importPage(page, revision); |
229 | 233 | } |
230 | 234 | |
231 | | - protected abstract int importPage(WikiPage page, Date timestamp) throws PersistenceException; |
| 235 | + protected abstract int importPage(WikiPage page, RevisionInfo revision) throws PersistenceException; |
232 | 236 | |
233 | 237 | public int getProgressInterval() { |
234 | 238 | return progressInterval; |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/processor/XmlDumpDriver.java |
— | — | @@ -19,8 +19,10 @@ |
20 | 20 | import de.brightbyte.job.BlockingJobQueue; |
21 | 21 | import de.brightbyte.util.ErrorHandler; |
22 | 22 | import de.brightbyte.util.PersistenceException; |
| 23 | +import de.brightbyte.wikiword.Corpus; |
23 | 24 | import de.brightbyte.wikiword.Namespace; |
24 | 25 | import de.brightbyte.wikiword.NamespaceSet; |
| 26 | +import de.brightbyte.wikiword.RevisionInfo; |
25 | 27 | import de.brightbyte.wikiword.TweakSet; |
26 | 28 | import de.brightbyte.wikiword.builder.InputFileHelper; |
27 | 29 | |
— | — | @@ -31,6 +33,7 @@ |
32 | 34 | public class XmlDumpDriver implements DataSourceDriver { |
33 | 35 | |
34 | 36 | protected URL dump; |
| 37 | + protected Corpus corpus; |
35 | 38 | protected InputStream in; |
36 | 39 | protected TweakSet tweaks; |
37 | 40 | protected LeveledOutput log; |
— | — | @@ -195,7 +198,8 @@ |
196 | 199 | } |
197 | 200 | |
198 | 201 | protected void importPage(Page page, Revision revision) throws IOException, PersistenceException { |
199 | | - importer.handlePage(page.Id, page.Title.Namespace, page.Title.Text, revision.Text, revision.Timestamp.getTime()); |
| 202 | + RevisionInfo r = new RevisionInfo(corpus, page.Id, revision.Id, revision.Timestamp.getTime(), page.Title.Text, page.Title.Namespace); |
| 203 | + importer.handlePage(r, revision.Text); |
200 | 204 | } |
201 | 205 | |
202 | 206 | protected void handleImportError(String message, Throwable e) { |
— | — | @@ -205,22 +209,22 @@ |
206 | 210 | } |
207 | 211 | } |
208 | 212 | |
209 | | - public XmlDumpDriver(URL dump, InputFileHelper inputHelper, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
| 213 | + public XmlDumpDriver(Corpus corpus, URL dump, InputFileHelper inputHelper, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
210 | 214 | if (dump==null) throw new NullPointerException(); |
211 | 215 | this.dump= dump; |
212 | | - init(inputHelper, log, errorHandler, tweaks); |
| 216 | + init(corpus, inputHelper, log, errorHandler, tweaks); |
213 | 217 | } |
214 | 218 | |
215 | | - public XmlDumpDriver(InputStream in, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
| 219 | + public XmlDumpDriver(Corpus corpus, InputStream in, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
216 | 220 | if (in==null) throw new NullPointerException(); |
217 | 221 | this.in= in; |
218 | | - init(null, log, errorHandler, tweaks); |
| 222 | + init(corpus, null, log, errorHandler, tweaks); |
219 | 223 | } |
220 | 224 | |
221 | 225 | private int importQueueCapacity = 0; |
222 | 226 | private InputFileHelper inputHelper; |
223 | 227 | |
224 | | - private void init(InputFileHelper inputHelper, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
| 228 | + private void init(Corpus corpus, InputFileHelper inputHelper, LeveledOutput log, ErrorHandler<XmlDumpDriver, Throwable, RuntimeException> errorHandler, TweakSet tweaks) { |
225 | 229 | if (log==null) throw new NullPointerException(); |
226 | 230 | if (tweaks==null) throw new NullPointerException(); |
227 | 231 | if (inputHelper==null && in==null) throw new NullPointerException(); |
— | — | @@ -229,6 +233,7 @@ |
230 | 234 | this.log = log; |
231 | 235 | this.inputHelper = inputHelper; |
232 | 236 | this.errorHandler = errorHandler; |
| 237 | + this.corpus = corpus; |
233 | 238 | |
234 | 239 | importQueueCapacity = tweaks.getTweak("dumpdriver.pageImportQueue", 8); |
235 | 240 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/processor/WikiWordPageProcessor.java |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | import de.brightbyte.io.Output; |
9 | 9 | import de.brightbyte.util.PersistenceException; |
10 | 10 | import de.brightbyte.wikiword.NamespaceSet; |
| 11 | +import de.brightbyte.wikiword.RevisionInfo; |
11 | 12 | |
12 | 13 | /** |
13 | 14 | * A WikiWordImporter receives data from a ImportDriver; it will generally analyze the data, |
— | — | @@ -44,15 +45,12 @@ |
45 | 46 | * do somethign meaningful with the data it is given, usually to analyze it and then store the result |
46 | 47 | * somewhere. |
47 | 48 | * |
48 | | - * @param id unique page id |
49 | | - * @param namespace the page's namespace id |
50 | | - * @param title the page's title, unique within the namespace |
| 49 | + * @param revision revision info |
51 | 50 | * @param text the page's full wiki-text |
52 | | - * @param time the timestamp of the page's last modification |
53 | 51 | * @throws IOException |
54 | 52 | * @throws PersistenceException |
55 | 53 | */ |
56 | | - public void handlePage(int id, int namespace, String title, String text, Date time) throws IOException, PersistenceException; |
| 54 | + public void handlePage(RevisionInfo revision, String text) throws IOException, PersistenceException; |
57 | 55 | |
58 | 56 | /** |
59 | 57 | * called to prepare for a new improt run, after reset, but before initialize. |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportDump.java |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | |
109 | 109 | ///////////////////////// main import run //////////////////////////////////// |
110 | 110 | if (agenda.beginTask("ImportDump.run", "analysis")) { |
111 | | - DataSourceDriver driver = new XmlDumpDriver(getDumpFileURL(), inputHelper, getLogOutput(), new FatalBackgroundErrorHandler<XmlDumpDriver, Throwable, RuntimeException>(), tweaks); |
| 111 | + DataSourceDriver driver = new XmlDumpDriver(getCorpus(), getDumpFileURL(), inputHelper, getLogOutput(), new FatalBackgroundErrorHandler<XmlDumpDriver, Throwable, RuntimeException>(), tweaks); |
112 | 112 | |
113 | 113 | importer.reset(); |
114 | 114 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/PropertyImporter.java |
— | — | @@ -1,6 +1,5 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import java.util.Date; |
5 | 4 | import java.util.Map; |
6 | 5 | import java.util.Set; |
7 | 6 | |
— | — | @@ -9,9 +8,10 @@ |
10 | 9 | import de.brightbyte.util.PersistenceException; |
11 | 10 | import de.brightbyte.wikiword.ConceptType; |
12 | 11 | import de.brightbyte.wikiword.ResourceType; |
| 12 | +import de.brightbyte.wikiword.RevisionInfo; |
13 | 13 | import de.brightbyte.wikiword.TweakSet; |
| 14 | +import de.brightbyte.wikiword.analyzer.WikiPage; |
14 | 15 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
15 | | -import de.brightbyte.wikiword.analyzer.WikiPage; |
16 | 16 | import de.brightbyte.wikiword.store.builder.ConceptBasedStoreBuilder; |
17 | 17 | import de.brightbyte.wikiword.store.builder.IncrementalStoreBuilder; |
18 | 18 | import de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder; |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | */ |
46 | 46 | |
47 | 47 | @Override |
48 | | - public int importPage(WikiPage analyzerPage, Date timestamp) throws PersistenceException { |
| 48 | + public int importPage(WikiPage analyzerPage, RevisionInfo revision) throws PersistenceException { |
49 | 49 | String name = analyzerPage.getConceptName(); |
50 | 50 | String rcName = analyzerPage.getResourceName(); |
51 | 51 | |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | ConceptType ctype = analyzerPage.getConceptType(); |
57 | 57 | |
58 | 58 | if (buildConcepts) { |
59 | | - rcId = storeResource(rcName, rcType, timestamp); |
| 59 | + rcId = storeResource(revision.getPageId(), revision.getRevisionId(), rcName, rcType, revision.getRevisionTimestamp()); |
60 | 60 | |
61 | 61 | if (rcType == ResourceType.REDIRECT) { |
62 | 62 | storeAlias(analyzerPage, rcId); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | import de.brightbyte.wikiword.ExtractionRule; |
15 | 15 | import de.brightbyte.wikiword.Namespace; |
16 | 16 | import de.brightbyte.wikiword.ResourceType; |
| 17 | +import de.brightbyte.wikiword.RevisionInfo; |
17 | 18 | import de.brightbyte.wikiword.TweakSet; |
18 | 19 | import de.brightbyte.wikiword.analyzer.WikiPage; |
19 | 20 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
— | — | @@ -250,7 +251,7 @@ |
251 | 252 | } |
252 | 253 | |
253 | 254 | @Override |
254 | | - public int importPage(WikiPage analyzerPage, Date timestamp) throws PersistenceException { |
| 255 | + public int importPage(WikiPage analyzerPage, RevisionInfo revision) throws PersistenceException { |
255 | 256 | ResourceType rcType = analyzerPage.getResourceType(); |
256 | 257 | String name = analyzerPage.getConceptName(); |
257 | 258 | String rcName = analyzerPage.getResourceName(); |
— | — | @@ -259,7 +260,7 @@ |
260 | 261 | //String title = analyzerPage.getTitle().toString(); |
261 | 262 | |
262 | 263 | //TODO: check if page is stored. if up to date, skip. if older, update. if missing, create. optionally force update. |
263 | | - int rcId = storeResource(rcName, rcType, timestamp); |
| 264 | + int rcId = storeResource(revision.getPageId(), revision.getRevisionId(), rcName, rcType, revision.getRevisionTimestamp()); |
264 | 265 | |
265 | 266 | if (storeRawText) { |
266 | 267 | textStore.storeRawText(rcId, rcName, text); |
— | — | @@ -599,9 +600,9 @@ |
600 | 601 | store.storeReference(rcId, term, targetId, targetName, rule); |
601 | 602 | } |
602 | 603 | |
603 | | - protected int storeResource(String name, ResourceType ptype, Date time) throws PersistenceException { |
| 604 | + protected int storeResource(int pageId, int revId, String name, ResourceType ptype, Date time) throws PersistenceException { |
604 | 605 | //NOTE: trust name. no need to check |
605 | | - return store.storeResource(name, ptype, time); |
| 606 | + return store.storeResource(pageId, revId, name, ptype, time); |
606 | 607 | } |
607 | 608 | |
608 | 609 | protected void storeSection(int rcId, String name, String page) throws PersistenceException { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/RevisionInfo.java |
— | — | @@ -0,0 +1,88 @@ |
| 2 | +package de.brightbyte.wikiword; |
| 3 | + |
| 4 | +import java.net.URL; |
| 5 | +import java.util.Date; |
| 6 | + |
| 7 | +public class RevisionInfo { |
| 8 | + private final int pageId; |
| 9 | + private final int revisionId; |
| 10 | + private final String pageTitle; |
| 11 | + private final Date revisionTimestamp; |
| 12 | + private final int namespace; |
| 13 | + private final Corpus corpus; |
| 14 | + |
| 15 | + public RevisionInfo(final Corpus corpus, final int pageId, final int revisionId, final Date revisionTimestamp, final String pageTitle, final int namespace) { |
| 16 | + super(); |
| 17 | + this.pageId = pageId; |
| 18 | + this.revisionId = revisionId; |
| 19 | + this.pageTitle = pageTitle; |
| 20 | + this.revisionTimestamp = revisionTimestamp; |
| 21 | + this.corpus = corpus; |
| 22 | + this.namespace = namespace; |
| 23 | + } |
| 24 | + |
| 25 | + public Corpus getCorpus() { |
| 26 | + return corpus; |
| 27 | + } |
| 28 | + |
| 29 | + public int getPageId() { |
| 30 | + return pageId; |
| 31 | + } |
| 32 | + |
| 33 | + public String getPageTitle() { |
| 34 | + return pageTitle; |
| 35 | + } |
| 36 | + |
| 37 | + public int getRevisionId() { |
| 38 | + return revisionId; |
| 39 | + } |
| 40 | + |
| 41 | + public Date getRevisionTimestamp() { |
| 42 | + return revisionTimestamp; |
| 43 | + } |
| 44 | + |
| 45 | + public int getNamespace() { |
| 46 | + return namespace; |
| 47 | + } |
| 48 | + |
| 49 | + public String toString() { |
| 50 | + return getPageTitle(); |
| 51 | + } |
| 52 | + |
| 53 | + public URL getPageURL() { |
| 54 | + return corpus.getResourceURL(getPageTitle()); |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public int hashCode() { |
| 59 | + final int PRIME = 31; |
| 60 | + int result = 1; |
| 61 | + result = PRIME * result + ((corpus == null) ? 0 : corpus.hashCode()); |
| 62 | + result = PRIME * result + pageId; |
| 63 | + result = PRIME * result + revisionId; |
| 64 | + return result; |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public boolean equals(Object obj) { |
| 69 | + if (this == obj) |
| 70 | + return true; |
| 71 | + if (obj == null) |
| 72 | + return false; |
| 73 | + if (getClass() != obj.getClass()) |
| 74 | + return false; |
| 75 | + final RevisionInfo other = (RevisionInfo) obj; |
| 76 | + if (corpus == null) { |
| 77 | + if (other.corpus != null) |
| 78 | + return false; |
| 79 | + } else if (!corpus.equals(other.corpus)) |
| 80 | + return false; |
| 81 | + if (pageId != other.pageId) |
| 82 | + return false; |
| 83 | + if (revisionId != other.revisionId) |
| 84 | + return false; |
| 85 | + return true; |
| 86 | + } |
| 87 | + |
| 88 | + |
| 89 | +} |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/extract/TextExtractor.java |
— | — | @@ -1,6 +1,5 @@ |
2 | 2 | package de.brightbyte.wikiword.extract; |
3 | 3 | |
4 | | -import java.util.Date; |
5 | 4 | import java.util.HashSet; |
6 | 5 | import java.util.Set; |
7 | 6 | |
— | — | @@ -9,6 +8,7 @@ |
10 | 9 | import de.brightbyte.wikiword.Namespace; |
11 | 10 | import de.brightbyte.wikiword.NamespaceSet; |
12 | 11 | import de.brightbyte.wikiword.ResourceType; |
| 12 | +import de.brightbyte.wikiword.RevisionInfo; |
13 | 13 | import de.brightbyte.wikiword.TweakSet; |
14 | 14 | import de.brightbyte.wikiword.analyzer.WikiPage; |
15 | 15 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | } |
72 | 72 | |
73 | 73 | @Override |
74 | | - public int importPage(WikiPage analyzerPage, Date timestamp) throws PersistenceException { |
| 74 | + public int importPage(WikiPage analyzerPage, RevisionInfo revision) throws PersistenceException { |
75 | 75 | |
76 | 76 | ResourceType ptype = analyzerPage.getResourceType(); |
77 | 77 | String name = analyzerPage.getName().toString(); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/extract/ExtractFromDump.java |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | processor.setLogOutput(getLogOutput()); |
68 | 68 | processor.configure(args); |
69 | 69 | |
70 | | - DataSourceDriver driver = new XmlDumpDriver(dumpFile, inputHelper, getLogOutput(), new FatalBackgroundErrorHandler<XmlDumpDriver, Throwable, RuntimeException>(), tweaks); |
| 70 | + DataSourceDriver driver = new XmlDumpDriver(getCorpus(), dumpFile, inputHelper, getLogOutput(), new FatalBackgroundErrorHandler<XmlDumpDriver, Throwable, RuntimeException>(), tweaks); |
71 | 71 | |
72 | 72 | processor.reset(); |
73 | 73 | processor.prepare(); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DebugLocalConceptStoreBuilder.java |
— | — | @@ -638,14 +638,14 @@ |
639 | 639 | return conceptCounter; |
640 | 640 | } |
641 | 641 | |
642 | | - public int storeResource(String name, ResourceType ptype, Date time) { |
| 642 | + public int storeResource(int pageId, int revId, String name, ResourceType ptype, Date time) { |
643 | 643 | resourceCounter++; |
644 | | - log("+ storeResource: id = "+resourceCounter+", name = "+name+", type = "+ptype+", timestamp = "+time); |
| 644 | + log("+ storeResource: page_id = "+pageId+", revision_id = "+revId+", id = "+resourceCounter+", name = "+name+", type = "+ptype+", timestamp = "+time); |
645 | 645 | return resourceCounter; |
646 | 646 | } |
647 | 647 | |
648 | | - public int storeResourceAbout(String name, ResourceType ptype, Date time, int conceptId, String conceptName) { |
649 | | - int resourceId = storeResource(name, ptype, time); |
| 648 | + public int storeResourceAbout(int pageId, int revId, String name, ResourceType ptype, Date time, int conceptId, String conceptName) { |
| 649 | + int resourceId = storeResource(pageId, revId, name, ptype, time); |
650 | 650 | storeAbout(resourceId, name, conceptId, conceptName); |
651 | 651 | return resourceId; |
652 | 652 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -5,16 +5,12 @@ |
6 | 6 | import java.sql.ResultSet; |
7 | 7 | import java.sql.SQLException; |
8 | 8 | import java.util.Date; |
9 | | -import java.util.Map; |
10 | 9 | import java.util.Random; |
11 | 10 | |
12 | 11 | import javax.sql.DataSource; |
13 | 12 | |
14 | | -import sun.security.action.GetLongAction; |
15 | | - |
16 | 13 | import de.brightbyte.application.Agenda; |
17 | 14 | import de.brightbyte.data.ChunkyBitSet; |
18 | | -import de.brightbyte.data.Functor; |
19 | 15 | import de.brightbyte.data.KeyValueStore; |
20 | 16 | import de.brightbyte.data.Pair; |
21 | 17 | import de.brightbyte.data.PersistentIdManager; |
— | — | @@ -332,8 +328,8 @@ |
333 | 329 | /** |
334 | 330 | * @see de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder#storeResourceAbout(java.lang.String, de.brightbyte.wikiword.ResourceType, java.util.Date, int conceptId, String conceptName) |
335 | 331 | */ |
336 | | - public int storeResourceAbout(String name, ResourceType ptype, Date time, int conceptId, String conceptName) throws PersistenceException { |
337 | | - int rcId = storeResource(name, ptype, time); |
| 332 | + public int storeResourceAbout(int pageId, int revId, String name, ResourceType ptype, Date time, int conceptId, String conceptName) throws PersistenceException { |
| 333 | + int rcId = storeResource(pageId, revId, name, ptype, time); |
338 | 334 | storeAbout(rcId, name, conceptId, conceptName); |
339 | 335 | return rcId; |
340 | 336 | } |
— | — | @@ -341,10 +337,13 @@ |
342 | 338 | /** |
343 | 339 | * @see de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder#storeResource(java.lang.String, de.brightbyte.wikiword.ResourceType, java.util.Date) |
344 | 340 | */ |
345 | | - public int storeResource(String name, ResourceType ptype, Date time) throws PersistenceException { |
| 341 | + public int storeResource(int pageId, int revId, String name, ResourceType ptype, Date time) throws PersistenceException { |
346 | 342 | try { |
347 | 343 | name = checkName(resourceInserter.getLastId()+1, name, "resource name ({0})", resourceInserter.getLastId()+1); |
348 | 344 | |
| 345 | + if (pageId>0) resourceInserter.updateInt("page_id", pageId ); |
| 346 | + if (revId>0) resourceInserter.updateInt("revision_id", revId ); |
| 347 | + |
349 | 348 | resourceInserter.updateString("name", name ); |
350 | 349 | resourceInserter.updateInt("type", ptype.getCode()); |
351 | 350 | resourceInserter.updateString("timestamp", timestampFormatter.format(time)); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/LocalConceptStoreBuilder.java |
— | — | @@ -22,10 +22,10 @@ |
23 | 23 | public abstract void storeDefinition(int rcId, int conceptId, String definition) |
24 | 24 | throws PersistenceException; |
25 | 25 | |
26 | | - public abstract int storeResource(String name, ResourceType ptype, |
| 26 | + public abstract int storeResource(int pageId, int revId, String name, ResourceType ptype, |
27 | 27 | Date time) throws PersistenceException; |
28 | 28 | |
29 | | - public abstract int storeResourceAbout(String name, ResourceType ptype, |
| 29 | + public abstract int storeResourceAbout(int pageId, int revId, String name, ResourceType ptype, |
30 | 30 | Date time, int concept, String conceptName) throws PersistenceException; |
31 | 31 | |
32 | 32 | public abstract int storeConcept(int rcId, String name, ConceptType ctype) |