-
Notifications
You must be signed in to change notification settings - Fork 296
Dbpedia History #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: history-extraction
Are you sure you want to change the base?
Dbpedia History #745
Changes from all commits
5342469
7174c71
d00cf7a
89c6d5c
6461bce
9cdeb79
29329c0
06202d5
053f0ab
2050875
7ad20ae
f55d803
f7686ec
782214b
984b5d4
021ca01
7001bcd
78d91d6
d7929da
167b342
6112b94
e97dd88
969f3b4
e89f813
2246f21
da5f135
eb68385
cb076dd
9f870bb
837e402
cb1526d
0f85985
bbf64f4
37376c1
9ff3818
8932d97
367dfe9
a8c7736
716a780
fb87924
a3a8063
376d1cc
b247260
d9c12f7
4221c0f
a755007
67312b1
b08442d
4286753
a6ebbc5
f87066b
447bc7a
e119c8b
f97dafa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -94,10 +94,10 @@ class Config(val configPath: String) extends | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||
| * Number of parallel processes allowed. Depends on the number of cores, type of disk and IO speed | ||||||||||||||||||||||||||||||||
| * Number of parallel processes allowed. Depends on the number of cores, type of disk, and IO speed | ||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| lazy val parallelProcesses: Int = this.getProperty("parallel-processes", "4").trim.toInt | ||||||||||||||||||||||||||||||||
| lazy val parallelProcesses: Int = this.getProperty("parallel-processes", "1").trim.toInt | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lazy val sparkMaster: String = Option(getString(this, "spark-master")).getOrElse("local[*]") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -259,18 +259,32 @@ class Config(val configPath: String) extends | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lazy val mediawikiConnection: MediaWikiConnection = Try { | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| MediaWikiConnection( | ||||||||||||||||||||||||||||||||
| apiUrl = this.getProperty("mwc-apiUrl", "").trim, | ||||||||||||||||||||||||||||||||
| apiType = this.getProperty("mwc-type", "").trim, | ||||||||||||||||||||||||||||||||
| apiUrl = this.getProperty("mwc-type").trim match { | ||||||||||||||||||||||||||||||||
| case "rest" => this.getProperty("mwc-apiRestUrl", "").trim | ||||||||||||||||||||||||||||||||
| case "mwc" => this.getProperty("mwc-apiMWCUrl", "").trim | ||||||||||||||||||||||||||||||||
| case "local" => this.getProperty("mwc-apiLocalUrl", "").trim | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| maxRetries = this.getProperty("mwc-maxRetries", "4").trim.toInt, | ||||||||||||||||||||||||||||||||
|
Comment on lines
+264
to
270
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle unknown The - apiUrl = this.getProperty("mwc-type").trim match {
- case "rest" => this.getProperty("mwc-apiRestUrl", "").trim
- case "mwc" => this.getProperty("mwc-apiMWCUrl", "").trim
- case "local" => this.getProperty("mwc-apiLocalUrl", "").trim
- },
+ apiUrl = this.getProperty("mwc-type", "mwc").trim match {
+ case "rest" => this.getProperty("mwc-apiRestUrl", "").trim
+ case "mwc" => this.getProperty("mwc-apiMWCUrl", "").trim
+ case "local" => this.getProperty("mwc-apiLocalUrl", "").trim
+ case other => throw new IllegalArgumentException(s"Unsupported mwc-type '$other'")
+ },📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| connectMs = this.getProperty("mwc-connectMs", "2000").trim.toInt, | ||||||||||||||||||||||||||||||||
| readMs = this.getProperty("mwc-readMs", "5000").trim.toInt, | ||||||||||||||||||||||||||||||||
| sleepFactor = this.getProperty("mwc-sleepFactor", "1000").trim.toInt | ||||||||||||||||||||||||||||||||
| sleepFactor = this.getProperty("mwc-sleepFactor", "1000").trim.toInt, | ||||||||||||||||||||||||||||||||
| maxlag = this.getProperty("mwc-maxlag", "5").trim.toInt, | ||||||||||||||||||||||||||||||||
| useragent = this.getProperty("mwc-useragent", "anonymous").trim, | ||||||||||||||||||||||||||||||||
| gzip = this.getProperty("mwc-gzip","false").trim.toBoolean, | ||||||||||||||||||||||||||||||||
| retryafter = this.getProperty("mwc-retryafter", "false").trim.toBoolean, | ||||||||||||||||||||||||||||||||
| accept = this.getProperty("mwc-accept", "text/html").trim, | ||||||||||||||||||||||||||||||||
| charset = this.getProperty("mwc-charset", "utf-8").trim, | ||||||||||||||||||||||||||||||||
| profile = this.getProperty("mwc-profile", "https://www.mediawiki.org/wiki/Specs/HTML/2.1.0").trim | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| } match{ | ||||||||||||||||||||||||||||||||
| case Success(s) => s | ||||||||||||||||||||||||||||||||
| case Failure(f) => throw new IllegalArgumentException("Not all necessary parameters for the 'MediaWikiConnection' class were provided or could not be parsed to the expected type.", f) | ||||||||||||||||||||||||||||||||
| case Failure(f) => throw new IllegalArgumentException("Some parameters necessary for the 'MediaWikiConnection' class were not provided or could not be parsed to the expected type.", f) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lazy val abstractParameters: AbstractParameters = Try { | ||||||||||||||||||||||||||||||||
| AbstractParameters( | ||||||||||||||||||||||||||||||||
| abstractQuery = this.getProperty("abstract-query", "").trim, | ||||||||||||||||||||||||||||||||
|
|
@@ -364,12 +378,20 @@ object Config{ | |||||||||||||||||||||||||||||||
| * @param sleepFactor | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| case class MediaWikiConnection( | ||||||||||||||||||||||||||||||||
| apiUrl: String, | ||||||||||||||||||||||||||||||||
| maxRetries: Int, | ||||||||||||||||||||||||||||||||
| connectMs: Int, | ||||||||||||||||||||||||||||||||
| readMs: Int, | ||||||||||||||||||||||||||||||||
| sleepFactor: Int | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| apiType: String, | ||||||||||||||||||||||||||||||||
| apiUrl: String, | ||||||||||||||||||||||||||||||||
| maxRetries: Int, | ||||||||||||||||||||||||||||||||
| connectMs: Int, | ||||||||||||||||||||||||||||||||
| readMs: Int, | ||||||||||||||||||||||||||||||||
| sleepFactor: Int, | ||||||||||||||||||||||||||||||||
| maxlag: Int, | ||||||||||||||||||||||||||||||||
| useragent: String, | ||||||||||||||||||||||||||||||||
| gzip: Boolean, | ||||||||||||||||||||||||||||||||
| retryafter: Boolean, | ||||||||||||||||||||||||||||||||
| accept : String, | ||||||||||||||||||||||||||||||||
| charset: String, | ||||||||||||||||||||||||||||||||
| profile: String | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| case class AbstractParameters( | ||||||||||||||||||||||||||||||||
| abstractQuery: String, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect substring when stripping REST wiki links
The new
cleanLinkbranch drops the first three characters after./and assumes?title=is absent. For REST HTML such ashref="./?title=Main_Page&oldid=123", the current code returnstle=Main_Page&oldid=123, which later becomeshttp://dbpedia.org/resource/tle=Main_Page&oldid=123. Similarly,/wiki/Foo?oldid=123keeps the?oldidtail. Both produce invalid resources. Please normalize the prefixes and strip any?title=/query/fragment portions before building the DBpedia URI.📝 Committable suggestion