repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java | EntityStatisticsProcessor.countPropertyMain | private void countPropertyMain(UsageStatistics usageStatistics,
PropertyIdValue property, int count) {
addPropertyCounters(usageStatistics, property);
usageStatistics.propertyCountsMain.put(property,
usageStatistics.propertyCountsMain.get(property) + count);
} | java | private void countPropertyMain(UsageStatistics usageStatistics,
PropertyIdValue property, int count) {
addPropertyCounters(usageStatistics, property);
usageStatistics.propertyCountsMain.put(property,
usageStatistics.propertyCountsMain.get(property) + count);
} | [
"private",
"void",
"countPropertyMain",
"(",
"UsageStatistics",
"usageStatistics",
",",
"PropertyIdValue",
"property",
",",
"int",
"count",
")",
"{",
"addPropertyCounters",
"(",
"usageStatistics",
",",
"property",
")",
";",
"usageStatistics",
".",
"propertyCountsMain",
... | Counts additional occurrences of a property as the main property of
statements.
@param usageStatistics
statistics object where count is stored
@param property
the property to count
@param count
the number of times to count the property | [
"Counts",
"additional",
"occurrences",
"of",
"a",
"property",
"as",
"the",
"main",
"property",
"of",
"statements",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java#L369-L374 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java | EntityStatisticsProcessor.addPropertyCounters | private void addPropertyCounters(UsageStatistics usageStatistics,
PropertyIdValue property) {
if (!usageStatistics.propertyCountsMain.containsKey(property)) {
usageStatistics.propertyCountsMain.put(property, 0);
usageStatistics.propertyCountsQualifier.put(property, 0);
usageStatistics.propertyCountsRefere... | java | private void addPropertyCounters(UsageStatistics usageStatistics,
PropertyIdValue property) {
if (!usageStatistics.propertyCountsMain.containsKey(property)) {
usageStatistics.propertyCountsMain.put(property, 0);
usageStatistics.propertyCountsQualifier.put(property, 0);
usageStatistics.propertyCountsRefere... | [
"private",
"void",
"addPropertyCounters",
"(",
"UsageStatistics",
"usageStatistics",
",",
"PropertyIdValue",
"property",
")",
"{",
"if",
"(",
"!",
"usageStatistics",
".",
"propertyCountsMain",
".",
"containsKey",
"(",
"property",
")",
")",
"{",
"usageStatistics",
".... | Initializes the counters for a property to zero if not done yet.
@param usageStatistics
statistics object to initialize
@param property
the property to count | [
"Initializes",
"the",
"counters",
"for",
"a",
"property",
"to",
"zero",
"if",
"not",
"done",
"yet",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java#L419-L426 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java | EntityStatisticsProcessor.countKey | private void countKey(Map<String, Integer> map, String key, int count) {
if (map.containsKey(key)) {
map.put(key, map.get(key) + count);
} else {
map.put(key, count);
}
} | java | private void countKey(Map<String, Integer> map, String key, int count) {
if (map.containsKey(key)) {
map.put(key, map.get(key) + count);
} else {
map.put(key, count);
}
} | [
"private",
"void",
"countKey",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"map",
",",
"String",
"key",
",",
"int",
"count",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"map",... | Helper method that stores in a hash map how often a certain key occurs.
If the key has not been encountered yet, a new entry is created for it in
the map. Otherwise the existing value for the key is incremented.
@param map
the map where the counts are stored
@param key
the key to be counted
@param count
value by which... | [
"Helper",
"method",
"that",
"stores",
"in",
"a",
"hash",
"map",
"how",
"often",
"a",
"certain",
"key",
"occurs",
".",
"If",
"the",
"key",
"has",
"not",
"been",
"encountered",
"yet",
"a",
"new",
"entry",
"is",
"created",
"for",
"it",
"in",
"the",
"map",... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java#L441-L447 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java | WorldMapProcessor.addSite | public void addSite(String siteKey) {
ValueMap gv = new ValueMap(siteKey);
if (!this.valueMaps.contains(gv)) {
this.valueMaps.add(gv);
}
} | java | public void addSite(String siteKey) {
ValueMap gv = new ValueMap(siteKey);
if (!this.valueMaps.contains(gv)) {
this.valueMaps.add(gv);
}
} | [
"public",
"void",
"addSite",
"(",
"String",
"siteKey",
")",
"{",
"ValueMap",
"gv",
"=",
"new",
"ValueMap",
"(",
"siteKey",
")",
";",
"if",
"(",
"!",
"this",
".",
"valueMaps",
".",
"contains",
"(",
"gv",
")",
")",
"{",
"this",
".",
"valueMaps",
".",
... | Registers a new site for specific data collection. If null is used as a
site key, then all data is collected.
@param siteKey
the site to collect geo data for | [
"Registers",
"a",
"new",
"site",
"for",
"specific",
"data",
"collection",
".",
"If",
"null",
"is",
"used",
"as",
"a",
"site",
"key",
"then",
"all",
"data",
"is",
"collected",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java#L179-L184 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java | WorldMapProcessor.countCoordinateStatement | private void countCoordinateStatement(Statement statement,
ItemDocument itemDocument) {
Value value = statement.getValue();
if (!(value instanceof GlobeCoordinatesValue)) {
return;
}
GlobeCoordinatesValue coordsValue = (GlobeCoordinatesValue) value;
if (!this.globe.equals((coordsValue.getGlobe()))) {
... | java | private void countCoordinateStatement(Statement statement,
ItemDocument itemDocument) {
Value value = statement.getValue();
if (!(value instanceof GlobeCoordinatesValue)) {
return;
}
GlobeCoordinatesValue coordsValue = (GlobeCoordinatesValue) value;
if (!this.globe.equals((coordsValue.getGlobe()))) {
... | [
"private",
"void",
"countCoordinateStatement",
"(",
"Statement",
"statement",
",",
"ItemDocument",
"itemDocument",
")",
"{",
"Value",
"value",
"=",
"statement",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"GlobeCoordinatesValue",
... | Counts the coordinates stored in a single statement for the relevant
property, if they are actually given and valid.
@param statement
@param itemDocument | [
"Counts",
"the",
"coordinates",
"stored",
"in",
"a",
"single",
"statement",
"for",
"the",
"relevant",
"property",
"if",
"they",
"are",
"actually",
"given",
"and",
"valid",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java#L216-L247 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java | WorldMapProcessor.countCoordinates | private void countCoordinates(int xCoord, int yCoord,
ItemDocument itemDocument) {
for (String siteKey : itemDocument.getSiteLinks().keySet()) {
Integer count = this.siteCounts.get(siteKey);
if (count == null) {
this.siteCounts.put(siteKey, 1);
} else {
this.siteCounts.put(siteKey, count + 1);
... | java | private void countCoordinates(int xCoord, int yCoord,
ItemDocument itemDocument) {
for (String siteKey : itemDocument.getSiteLinks().keySet()) {
Integer count = this.siteCounts.get(siteKey);
if (count == null) {
this.siteCounts.put(siteKey, 1);
} else {
this.siteCounts.put(siteKey, count + 1);
... | [
"private",
"void",
"countCoordinates",
"(",
"int",
"xCoord",
",",
"int",
"yCoord",
",",
"ItemDocument",
"itemDocument",
")",
"{",
"for",
"(",
"String",
"siteKey",
":",
"itemDocument",
".",
"getSiteLinks",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"Integ... | Counts a single pair of coordinates in all datasets.
@param xCoord
@param yCoord
@param itemDocument | [
"Counts",
"a",
"single",
"pair",
"of",
"coordinates",
"in",
"all",
"datasets",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java#L256-L271 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java | WorldMapProcessor.writeImages | private void writeImages() {
for (ValueMap gv : this.valueMaps) {
gv.writeImage();
}
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("map-site-count.csv"))) {
out.println("Site key,Number of geo items");
out.println("wikidata total," + this.count);
for (Entry<Str... | java | private void writeImages() {
for (ValueMap gv : this.valueMaps) {
gv.writeImage();
}
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("map-site-count.csv"))) {
out.println("Site key,Number of geo items");
out.println("wikidata total," + this.count);
for (Entry<Str... | [
"private",
"void",
"writeImages",
"(",
")",
"{",
"for",
"(",
"ValueMap",
"gv",
":",
"this",
".",
"valueMaps",
")",
"{",
"gv",
".",
"writeImage",
"(",
")",
";",
"}",
"try",
"(",
"PrintStream",
"out",
"=",
"new",
"PrintStream",
"(",
"ExampleHelpers",
"."... | Writes image files for all data that was collected and the statistics
file for all sites. | [
"Writes",
"image",
"files",
"for",
"all",
"data",
"that",
"was",
"collected",
"and",
"the",
"statistics",
"file",
"for",
"all",
"sites",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java#L285-L300 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java | WorldMapProcessor.getColor | private int getColor(int value) {
if (value == 0) {
return 0;
}
double scale = Math.log10(value) / Math.log10(this.topValue);
double lengthScale = Math.min(1.0, scale) * (colors.length - 1);
int index = 1 + (int) lengthScale;
if (index == colors.length) {
index--;
}
double partScale = lengthScale... | java | private int getColor(int value) {
if (value == 0) {
return 0;
}
double scale = Math.log10(value) / Math.log10(this.topValue);
double lengthScale = Math.min(1.0, scale) * (colors.length - 1);
int index = 1 + (int) lengthScale;
if (index == colors.length) {
index--;
}
double partScale = lengthScale... | [
"private",
"int",
"getColor",
"(",
"int",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"double",
"scale",
"=",
"Math",
".",
"log10",
"(",
"value",
")",
"/",
"Math",
".",
"log10",
"(",
"this",
".",
"topValue... | Returns a color for a given absolute number that is to be shown on the
map.
@param value
@return | [
"Returns",
"a",
"color",
"for",
"a",
"given",
"absolute",
"number",
"that",
"is",
"to",
"be",
"shown",
"on",
"the",
"map",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/WorldMapProcessor.java#L336-L360 | train |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/ReferenceBuilder.java | ReferenceBuilder.withPropertyValue | public ReferenceBuilder withPropertyValue(PropertyIdValue propertyIdValue,
Value value) {
getSnakList(propertyIdValue).add(
factory.getValueSnak(propertyIdValue, value));
return getThis();
} | java | public ReferenceBuilder withPropertyValue(PropertyIdValue propertyIdValue,
Value value) {
getSnakList(propertyIdValue).add(
factory.getValueSnak(propertyIdValue, value));
return getThis();
} | [
"public",
"ReferenceBuilder",
"withPropertyValue",
"(",
"PropertyIdValue",
"propertyIdValue",
",",
"Value",
"value",
")",
"{",
"getSnakList",
"(",
"propertyIdValue",
")",
".",
"add",
"(",
"factory",
".",
"getValueSnak",
"(",
"propertyIdValue",
",",
"value",
")",
"... | Adds the given property and value to the constructed reference.
@param propertyIdValue
the property to add
@param value
the value to add
@return builder object to continue construction | [
"Adds",
"the",
"given",
"property",
"and",
"value",
"to",
"the",
"constructed",
"reference",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/ReferenceBuilder.java#L70-L75 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/DumpProcessingOutputAction.java | DumpProcessingOutputAction.close | private static void close(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException ignored) {
logger.error("Failed to close output stream: "
+ ignored.getMessage());
}
}
} | java | private static void close(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException ignored) {
logger.error("Failed to close output stream: "
+ ignored.getMessage());
}
}
} | [
"private",
"static",
"void",
"close",
"(",
"Closeable",
"closeable",
")",
"{",
"if",
"(",
"closeable",
"!=",
"null",
")",
"{",
"try",
"{",
"closeable",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ignored",
")",
"{",
"logger",
".",
... | Closes a Closeable and swallows any exceptions that might occur in the
process.
@param closeable | [
"Closes",
"a",
"Closeable",
"and",
"swallows",
"any",
"exceptions",
"that",
"might",
"occur",
"in",
"the",
"process",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/DumpProcessingOutputAction.java#L347-L356 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ExampleHelpers.java | ExampleHelpers.configureLogging | public static void configureLogging() {
// Create the appender that will write log messages to the console.
ConsoleAppender consoleAppender = new ConsoleAppender();
// Define the pattern of log messages.
// Insert the string "%c{1}:%L" to also show class name and line.
String pattern = "%d{yyyy-MM-dd HH:mm:ss... | java | public static void configureLogging() {
// Create the appender that will write log messages to the console.
ConsoleAppender consoleAppender = new ConsoleAppender();
// Define the pattern of log messages.
// Insert the string "%c{1}:%L" to also show class name and line.
String pattern = "%d{yyyy-MM-dd HH:mm:ss... | [
"public",
"static",
"void",
"configureLogging",
"(",
")",
"{",
"// Create the appender that will write log messages to the console.",
"ConsoleAppender",
"consoleAppender",
"=",
"new",
"ConsoleAppender",
"(",
")",
";",
"// Define the pattern of log messages.",
"// Insert the string ... | Defines how messages should be logged. This method can be modified to
restrict the logging messages that are shown on the console or to change
their formatting. See the documentation of Log4J for details on how to do
this. | [
"Defines",
"how",
"messages",
"should",
"be",
"logged",
".",
"This",
"method",
"can",
"be",
"modified",
"to",
"restrict",
"the",
"logging",
"messages",
"that",
"are",
"shown",
"on",
"the",
"console",
"or",
"to",
"change",
"their",
"formatting",
".",
"See",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ExampleHelpers.java#L97-L109 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ExampleHelpers.java | ExampleHelpers.processEntitiesFromWikidataDump | public static void processEntitiesFromWikidataDump(
EntityDocumentProcessor entityDocumentProcessor) {
// Controller object for processing dumps:
DumpProcessingController dumpProcessingController = new DumpProcessingController(
"wikidatawiki");
dumpProcessingController.setOfflineMode(OFFLINE_MODE);
// ... | java | public static void processEntitiesFromWikidataDump(
EntityDocumentProcessor entityDocumentProcessor) {
// Controller object for processing dumps:
DumpProcessingController dumpProcessingController = new DumpProcessingController(
"wikidatawiki");
dumpProcessingController.setOfflineMode(OFFLINE_MODE);
// ... | [
"public",
"static",
"void",
"processEntitiesFromWikidataDump",
"(",
"EntityDocumentProcessor",
"entityDocumentProcessor",
")",
"{",
"// Controller object for processing dumps:",
"DumpProcessingController",
"dumpProcessingController",
"=",
"new",
"DumpProcessingController",
"(",
"\"wi... | Processes all entities in a Wikidata dump using the given entity
processor. By default, the most recent JSON dump will be used. In offline
mode, only the most recent previously downloaded file is considered.
@param entityDocumentProcessor
the object to use for processing entities in this dump | [
"Processes",
"all",
"entities",
"in",
"a",
"Wikidata",
"dump",
"using",
"the",
"given",
"entity",
"processor",
".",
"By",
"default",
"the",
"most",
"recent",
"JSON",
"dump",
"will",
"be",
"used",
".",
"In",
"offline",
"mode",
"only",
"the",
"most",
"recent... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ExampleHelpers.java#L119-L199 | train |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/BufferedValueConverter.java | BufferedValueConverter.addValue | void addValue(V value, Resource resource) {
this.valueQueue.add(value);
this.valueSubjectQueue.add(resource);
} | java | void addValue(V value, Resource resource) {
this.valueQueue.add(value);
this.valueSubjectQueue.add(resource);
} | [
"void",
"addValue",
"(",
"V",
"value",
",",
"Resource",
"resource",
")",
"{",
"this",
".",
"valueQueue",
".",
"add",
"(",
"value",
")",
";",
"this",
".",
"valueSubjectQueue",
".",
"add",
"(",
"resource",
")",
";",
"}"
] | Adds the given value to the list of values that should still be
serialized. The given RDF resource will be used as a subject.
@param value
the value to be serialized
@param resource
the RDF resource that is used as a subject for serialization | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"list",
"of",
"values",
"that",
"should",
"still",
"be",
"serialized",
".",
"The",
"given",
"RDF",
"resource",
"will",
"be",
"used",
"as",
"a",
"subject",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/BufferedValueConverter.java#L56-L59 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.processAliases | protected void processAliases(List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) {
for(MonolingualTextValue val : addAliases) {
addAlias(val);
}
for(MonolingualTextValue val : deleteAliases) {
deleteAlias(val);
}
} | java | protected void processAliases(List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) {
for(MonolingualTextValue val : addAliases) {
addAlias(val);
}
for(MonolingualTextValue val : deleteAliases) {
deleteAlias(val);
}
} | [
"protected",
"void",
"processAliases",
"(",
"List",
"<",
"MonolingualTextValue",
">",
"addAliases",
",",
"List",
"<",
"MonolingualTextValue",
">",
"deleteAliases",
")",
"{",
"for",
"(",
"MonolingualTextValue",
"val",
":",
"addAliases",
")",
"{",
"addAlias",
"(",
... | Processes changes on aliases, updating the planned state of the item.
@param addAliases
aliases that should be added to the document
@param deleteAliases
aliases that should be removed from the document | [
"Processes",
"changes",
"on",
"aliases",
"updating",
"the",
"planned",
"state",
"of",
"the",
"item",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L170-L177 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.deleteAlias | protected void deleteAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliases = newAliases.get(lang);
if (currentAliases != null) {
currentAliases.aliases.remove(alias);
currentAliases.deleted.add(alias);
curr... | java | protected void deleteAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliases = newAliases.get(lang);
if (currentAliases != null) {
currentAliases.aliases.remove(alias);
currentAliases.deleted.add(alias);
curr... | [
"protected",
"void",
"deleteAlias",
"(",
"MonolingualTextValue",
"alias",
")",
"{",
"String",
"lang",
"=",
"alias",
".",
"getLanguageCode",
"(",
")",
";",
"AliasesWithUpdate",
"currentAliases",
"=",
"newAliases",
".",
"get",
"(",
"lang",
")",
";",
"if",
"(",
... | Deletes an individual alias
@param alias
the alias to delete | [
"Deletes",
"an",
"individual",
"alias"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L185-L193 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.addAlias | protected void addAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliasesUpdate = newAliases.get(lang);
NameWithUpdate currentLabel = newLabels.get(lang);
// If there isn't any label for that language, put the alias there
... | java | protected void addAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliasesUpdate = newAliases.get(lang);
NameWithUpdate currentLabel = newLabels.get(lang);
// If there isn't any label for that language, put the alias there
... | [
"protected",
"void",
"addAlias",
"(",
"MonolingualTextValue",
"alias",
")",
"{",
"String",
"lang",
"=",
"alias",
".",
"getLanguageCode",
"(",
")",
";",
"AliasesWithUpdate",
"currentAliasesUpdate",
"=",
"newAliases",
".",
"get",
"(",
"lang",
")",
";",
"NameWithUp... | Adds an individual alias. It will be merged with the current
list of aliases, or added as a label if there is no label for
this item in this language yet.
@param alias
the alias to add | [
"Adds",
"an",
"individual",
"alias",
".",
"It",
"will",
"be",
"merged",
"with",
"the",
"current",
"list",
"of",
"aliases",
"or",
"added",
"as",
"a",
"label",
"if",
"there",
"is",
"no",
"label",
"for",
"this",
"item",
"in",
"this",
"language",
"yet",
".... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L203-L224 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.processDescriptions | protected void processDescriptions(List<MonolingualTextValue> descriptions) {
for(MonolingualTextValue description : descriptions) {
NameWithUpdate currentValue = newDescriptions.get(description.getLanguageCode());
// only mark the description as added if the value we are writing is different ... | java | protected void processDescriptions(List<MonolingualTextValue> descriptions) {
for(MonolingualTextValue description : descriptions) {
NameWithUpdate currentValue = newDescriptions.get(description.getLanguageCode());
// only mark the description as added if the value we are writing is different ... | [
"protected",
"void",
"processDescriptions",
"(",
"List",
"<",
"MonolingualTextValue",
">",
"descriptions",
")",
"{",
"for",
"(",
"MonolingualTextValue",
"description",
":",
"descriptions",
")",
"{",
"NameWithUpdate",
"currentValue",
"=",
"newDescriptions",
".",
"get",... | Adds descriptions to the item.
@param descriptions
the descriptions to add | [
"Adds",
"descriptions",
"to",
"the",
"item",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L232-L241 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.processLabels | protected void processLabels(List<MonolingualTextValue> labels) {
for(MonolingualTextValue label : labels) {
String lang = label.getLanguageCode();
NameWithUpdate currentValue = newLabels.get(lang);
if (currentValue == null || !currentValue.value.equals(label)) {
newLabel... | java | protected void processLabels(List<MonolingualTextValue> labels) {
for(MonolingualTextValue label : labels) {
String lang = label.getLanguageCode();
NameWithUpdate currentValue = newLabels.get(lang);
if (currentValue == null || !currentValue.value.equals(label)) {
newLabel... | [
"protected",
"void",
"processLabels",
"(",
"List",
"<",
"MonolingualTextValue",
">",
"labels",
")",
"{",
"for",
"(",
"MonolingualTextValue",
"label",
":",
"labels",
")",
"{",
"String",
"lang",
"=",
"label",
".",
"getLanguageCode",
"(",
")",
";",
"NameWithUpdat... | Adds labels to the item
@param labels
the labels to add | [
"Adds",
"labels",
"to",
"the",
"item"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L249-L265 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.getLabelUpdates | @JsonProperty("labels")
@JsonInclude(Include.NON_EMPTY)
public Map<String, TermImpl> getLabelUpdates() {
return getMonolingualUpdatedValues(newLabels);
} | java | @JsonProperty("labels")
@JsonInclude(Include.NON_EMPTY)
public Map<String, TermImpl> getLabelUpdates() {
return getMonolingualUpdatedValues(newLabels);
} | [
"@",
"JsonProperty",
"(",
"\"labels\"",
")",
"@",
"JsonInclude",
"(",
"Include",
".",
"NON_EMPTY",
")",
"public",
"Map",
"<",
"String",
",",
"TermImpl",
">",
"getLabelUpdates",
"(",
")",
"{",
"return",
"getMonolingualUpdatedValues",
"(",
"newLabels",
")",
";",... | Label accessor provided for JSON serialization only. | [
"Label",
"accessor",
"provided",
"for",
"JSON",
"serialization",
"only",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L270-L274 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.getDescriptionUpdates | @JsonProperty("descriptions")
@JsonInclude(Include.NON_EMPTY)
public Map<String, TermImpl> getDescriptionUpdates() {
return getMonolingualUpdatedValues(newDescriptions);
} | java | @JsonProperty("descriptions")
@JsonInclude(Include.NON_EMPTY)
public Map<String, TermImpl> getDescriptionUpdates() {
return getMonolingualUpdatedValues(newDescriptions);
} | [
"@",
"JsonProperty",
"(",
"\"descriptions\"",
")",
"@",
"JsonInclude",
"(",
"Include",
".",
"NON_EMPTY",
")",
"public",
"Map",
"<",
"String",
",",
"TermImpl",
">",
"getDescriptionUpdates",
"(",
")",
"{",
"return",
"getMonolingualUpdatedValues",
"(",
"newDescriptio... | Description accessor provided for JSON serialization only. | [
"Description",
"accessor",
"provided",
"for",
"JSON",
"serialization",
"only",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L279-L283 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.getAliasUpdates | @JsonProperty("aliases")
@JsonInclude(Include.NON_EMPTY)
public Map<String, List<TermImpl>> getAliasUpdates() {
Map<String, List<TermImpl>> updatedValues = new HashMap<>();
for(Map.Entry<String,AliasesWithUpdate> entry : newAliases.entrySet()) {
AliasesWithUpdate update = entry.getValue();... | java | @JsonProperty("aliases")
@JsonInclude(Include.NON_EMPTY)
public Map<String, List<TermImpl>> getAliasUpdates() {
Map<String, List<TermImpl>> updatedValues = new HashMap<>();
for(Map.Entry<String,AliasesWithUpdate> entry : newAliases.entrySet()) {
AliasesWithUpdate update = entry.getValue();... | [
"@",
"JsonProperty",
"(",
"\"aliases\"",
")",
"@",
"JsonInclude",
"(",
"Include",
".",
"NON_EMPTY",
")",
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"TermImpl",
">",
">",
"getAliasUpdates",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"... | Alias accessor provided for JSON serialization only | [
"Alias",
"accessor",
"provided",
"for",
"JSON",
"serialization",
"only"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L288-L305 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.getMonolingualUpdatedValues | protected Map<String, TermImpl> getMonolingualUpdatedValues(Map<String, NameWithUpdate> updates) {
Map<String, TermImpl> updatedValues = new HashMap<>();
for(NameWithUpdate update : updates.values()) {
if (!update.write) {
continue;
}
updatedValues.put(updat... | java | protected Map<String, TermImpl> getMonolingualUpdatedValues(Map<String, NameWithUpdate> updates) {
Map<String, TermImpl> updatedValues = new HashMap<>();
for(NameWithUpdate update : updates.values()) {
if (!update.write) {
continue;
}
updatedValues.put(updat... | [
"protected",
"Map",
"<",
"String",
",",
"TermImpl",
">",
"getMonolingualUpdatedValues",
"(",
"Map",
"<",
"String",
",",
"NameWithUpdate",
">",
"updates",
")",
"{",
"Map",
"<",
"String",
",",
"TermImpl",
">",
"updatedValues",
"=",
"new",
"HashMap",
"<>",
"(",... | Helper to format term updates as expected by the Wikibase API
@param updates
planned updates for the type of term
@return map ready to be serialized as JSON by Jackson | [
"Helper",
"to",
"format",
"term",
"updates",
"as",
"expected",
"by",
"the",
"Wikibase",
"API"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L453-L462 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/RdfSerializationAction.java | RdfSerializationAction.createRdfSerializer | protected RdfSerializer createRdfSerializer() throws IOException {
String outputDestinationFinal;
if (this.outputDestination != null) {
outputDestinationFinal = this.outputDestination;
} else {
outputDestinationFinal = "{PROJECT}" + this.taskName + "{DATE}"
+ ".nt";
}
OutputStream exportOutputStr... | java | protected RdfSerializer createRdfSerializer() throws IOException {
String outputDestinationFinal;
if (this.outputDestination != null) {
outputDestinationFinal = this.outputDestination;
} else {
outputDestinationFinal = "{PROJECT}" + this.taskName + "{DATE}"
+ ".nt";
}
OutputStream exportOutputStr... | [
"protected",
"RdfSerializer",
"createRdfSerializer",
"(",
")",
"throws",
"IOException",
"{",
"String",
"outputDestinationFinal",
";",
"if",
"(",
"this",
".",
"outputDestination",
"!=",
"null",
")",
"{",
"outputDestinationFinal",
"=",
"this",
".",
"outputDestination",
... | Creates a new RDF serializer based on the current configuration of this
object.
@return the newly created RDF serializer
@throws IOException
if there were problems opening the output files | [
"Creates",
"a",
"new",
"RDF",
"serializer",
"based",
"on",
"the",
"current",
"configuration",
"of",
"this",
"object",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/RdfSerializationAction.java#L213-L233 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/RdfSerializationAction.java | RdfSerializationAction.setTasks | private void setTasks(String tasks) {
for (String task : tasks.split(",")) {
if (KNOWN_TASKS.containsKey(task)) {
this.tasks |= KNOWN_TASKS.get(task);
this.taskName += (this.taskName.isEmpty() ? "" : "-") + task;
} else {
logger.warn("Unsupported RDF serialization task \"" + task
+ "\". Run wi... | java | private void setTasks(String tasks) {
for (String task : tasks.split(",")) {
if (KNOWN_TASKS.containsKey(task)) {
this.tasks |= KNOWN_TASKS.get(task);
this.taskName += (this.taskName.isEmpty() ? "" : "-") + task;
} else {
logger.warn("Unsupported RDF serialization task \"" + task
+ "\". Run wi... | [
"private",
"void",
"setTasks",
"(",
"String",
"tasks",
")",
"{",
"for",
"(",
"String",
"task",
":",
"tasks",
".",
"split",
"(",
"\",\"",
")",
")",
"{",
"if",
"(",
"KNOWN_TASKS",
".",
"containsKey",
"(",
"task",
")",
")",
"{",
"this",
".",
"tasks",
... | Sets the RDF serialization tasks based on the given string value.
@param tasks
a space-free, comma-separated list of task names | [
"Sets",
"the",
"RDF",
"serialization",
"tasks",
"based",
"on",
"the",
"given",
"string",
"value",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/RdfSerializationAction.java#L241-L251 | train |
Wikidata/Wikidata-Toolkit | wdtk-storage/src/main/java/org/wikidata/wdtk/storage/datastructures/BitVectorImpl.java | BitVectorImpl.resizeArray | void resizeArray(int newArraySize) {
long[] newArray = new long[newArraySize];
System.arraycopy(this.arrayOfBits, 0, newArray, 0,
Math.min(this.arrayOfBits.length, newArraySize));
this.arrayOfBits = newArray;
} | java | void resizeArray(int newArraySize) {
long[] newArray = new long[newArraySize];
System.arraycopy(this.arrayOfBits, 0, newArray, 0,
Math.min(this.arrayOfBits.length, newArraySize));
this.arrayOfBits = newArray;
} | [
"void",
"resizeArray",
"(",
"int",
"newArraySize",
")",
"{",
"long",
"[",
"]",
"newArray",
"=",
"new",
"long",
"[",
"newArraySize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"arrayOfBits",
",",
"0",
",",
"newArray",
",",
"0",
",",
"Math",... | Resizes the array that represents this bit vector.
@param newArraySize
new array size | [
"Resizes",
"the",
"array",
"that",
"represents",
"this",
"bit",
"vector",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-storage/src/main/java/org/wikidata/wdtk/storage/datastructures/BitVectorImpl.java#L310-L315 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.updateStatements | public ItemDocument updateStatements(ItemIdValue itemIdValue,
List<Statement> addStatements, List<Statement> deleteStatements,
String summary) throws MediaWikiApiErrorException, IOException {
ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher
.getEntityDocument(itemIdValue.getId());
... | java | public ItemDocument updateStatements(ItemIdValue itemIdValue,
List<Statement> addStatements, List<Statement> deleteStatements,
String summary) throws MediaWikiApiErrorException, IOException {
ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher
.getEntityDocument(itemIdValue.getId());
... | [
"public",
"ItemDocument",
"updateStatements",
"(",
"ItemIdValue",
"itemIdValue",
",",
"List",
"<",
"Statement",
">",
"addStatements",
",",
"List",
"<",
"Statement",
">",
"deleteStatements",
",",
"String",
"summary",
")",
"throws",
"MediaWikiApiErrorException",
",",
... | Updates the statements of the item document identified by the given item
id. The updates are computed with respect to the current data found
online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged.
@param itemIdValue
id of the document to be... | [
"Updates",
"the",
"statements",
"of",
"the",
"item",
"document",
"identified",
"by",
"the",
"given",
"item",
"id",
".",
"The",
"updates",
"are",
"computed",
"with",
"respect",
"to",
"the",
"current",
"data",
"found",
"online",
"making",
"sure",
"that",
"no",... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L390-L399 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.updateTermsStatements | public ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addStatements,
List<Statement> deleteStatements,
Stri... | java | public ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addStatements,
List<Statement> deleteStatements,
Stri... | [
"public",
"ItemDocument",
"updateTermsStatements",
"(",
"ItemIdValue",
"itemIdValue",
",",
"List",
"<",
"MonolingualTextValue",
">",
"addLabels",
",",
"List",
"<",
"MonolingualTextValue",
">",
"addDescriptions",
",",
"List",
"<",
"MonolingualTextValue",
">",
"addAliases... | Updates the terms and statements of the item document identified by the
given item id. The updates are computed with respect to the current data
found online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given ... | [
"Updates",
"the",
"terms",
"and",
"statements",
"of",
"the",
"item",
"document",
"identified",
"by",
"the",
"given",
"item",
"id",
".",
"The",
"updates",
"are",
"computed",
"with",
"respect",
"to",
"the",
"current",
"data",
"found",
"online",
"making",
"sure... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L437-L451 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.updateTermsStatements | @SuppressWarnings("unchecked")
public <T extends TermedStatementDocument> T updateTermsStatements(T currentDocument,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addState... | java | @SuppressWarnings("unchecked")
public <T extends TermedStatementDocument> T updateTermsStatements(T currentDocument,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addState... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"TermedStatementDocument",
">",
"T",
"updateTermsStatements",
"(",
"T",
"currentDocument",
",",
"List",
"<",
"MonolingualTextValue",
">",
"addLabels",
",",
"List",
"<",
"MonolingualTe... | Updates the terms and statements of the current document.
The updates are computed with respect to the current data in the document,
making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given language are kept distinct... | [
"Updates",
"the",
"terms",
"and",
"statements",
"of",
"the",
"current",
"document",
".",
"The",
"updates",
"are",
"computed",
"with",
"respect",
"to",
"the",
"current",
"data",
"in",
"the",
"document",
"making",
"sure",
"that",
"no",
"redundant",
"deletions",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L573-L589 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.nullEdit | public <T extends StatementDocument> void nullEdit(ItemIdValue itemId)
throws IOException, MediaWikiApiErrorException {
ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher
.getEntityDocument(itemId.getId());
nullEdit(currentDocument);
} | java | public <T extends StatementDocument> void nullEdit(ItemIdValue itemId)
throws IOException, MediaWikiApiErrorException {
ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher
.getEntityDocument(itemId.getId());
nullEdit(currentDocument);
} | [
"public",
"<",
"T",
"extends",
"StatementDocument",
">",
"void",
"nullEdit",
"(",
"ItemIdValue",
"itemId",
")",
"throws",
"IOException",
",",
"MediaWikiApiErrorException",
"{",
"ItemDocument",
"currentDocument",
"=",
"(",
"ItemDocument",
")",
"this",
".",
"wikibaseD... | Performs a null edit on an item. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI.
@param itemId
the document to perform a null edit on
@throws MediaWikiApiErrorException
if the API returns errors
@throws IOException
if there are any IO errors, such as missing network co... | [
"Performs",
"a",
"null",
"edit",
"on",
"an",
"item",
".",
"This",
"has",
"some",
"effects",
"on",
"Wikibase",
"such",
"as",
"refreshing",
"the",
"labels",
"of",
"the",
"referred",
"items",
"in",
"the",
"UI",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L602-L608 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.nullEdit | public <T extends StatementDocument> void nullEdit(PropertyIdValue propertyId)
throws IOException, MediaWikiApiErrorException {
PropertyDocument currentDocument = (PropertyDocument) this.wikibaseDataFetcher
.getEntityDocument(propertyId.getId());
nullEdit(currentDocument);
} | java | public <T extends StatementDocument> void nullEdit(PropertyIdValue propertyId)
throws IOException, MediaWikiApiErrorException {
PropertyDocument currentDocument = (PropertyDocument) this.wikibaseDataFetcher
.getEntityDocument(propertyId.getId());
nullEdit(currentDocument);
} | [
"public",
"<",
"T",
"extends",
"StatementDocument",
">",
"void",
"nullEdit",
"(",
"PropertyIdValue",
"propertyId",
")",
"throws",
"IOException",
",",
"MediaWikiApiErrorException",
"{",
"PropertyDocument",
"currentDocument",
"=",
"(",
"PropertyDocument",
")",
"this",
"... | Performs a null edit on a property. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI.
@param propertyId
the document to perform a null edit on
@throws MediaWikiApiErrorException
if the API returns errors
@throws IOException
if there are any IO errors, such as missing net... | [
"Performs",
"a",
"null",
"edit",
"on",
"a",
"property",
".",
"This",
"has",
"some",
"effects",
"on",
"Wikibase",
"such",
"as",
"refreshing",
"the",
"labels",
"of",
"the",
"referred",
"items",
"in",
"the",
"UI",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L621-L627 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java | WikibaseDataEditor.nullEdit | @SuppressWarnings("unchecked")
public <T extends StatementDocument> T nullEdit(T currentDocument)
throws IOException, MediaWikiApiErrorException {
StatementUpdate statementUpdate = new StatementUpdate(currentDocument,
Collections.<Statement>emptyList(), Collections.<Statement>emptyList());
statementUpdate.s... | java | @SuppressWarnings("unchecked")
public <T extends StatementDocument> T nullEdit(T currentDocument)
throws IOException, MediaWikiApiErrorException {
StatementUpdate statementUpdate = new StatementUpdate(currentDocument,
Collections.<Statement>emptyList(), Collections.<Statement>emptyList());
statementUpdate.s... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"StatementDocument",
">",
"T",
"nullEdit",
"(",
"T",
"currentDocument",
")",
"throws",
"IOException",
",",
"MediaWikiApiErrorException",
"{",
"StatementUpdate",
"statementUpdate",
"=",
... | Performs a null edit on an entity. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI.
@param currentDocument
the document to perform a null edit on
@throws MediaWikiApiErrorException
if the API returns errors
@throws IOException
if there are any IO errors, such as missing... | [
"Performs",
"a",
"null",
"edit",
"on",
"an",
"entity",
".",
"This",
"has",
"some",
"effects",
"on",
"Wikibase",
"such",
"as",
"refreshing",
"the",
"labels",
"of",
"the",
"referred",
"items",
"in",
"the",
"UI",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataEditor.java#L640-L651 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java | JsonSerializationProcessor.main | public static void main(String[] args) throws IOException {
ExampleHelpers.configureLogging();
JsonSerializationProcessor.printDocumentation();
JsonSerializationProcessor jsonSerializationProcessor = new JsonSerializationProcessor();
ExampleHelpers.processEntitiesFromWikidataDump(jsonSerializationProcessor);
... | java | public static void main(String[] args) throws IOException {
ExampleHelpers.configureLogging();
JsonSerializationProcessor.printDocumentation();
JsonSerializationProcessor jsonSerializationProcessor = new JsonSerializationProcessor();
ExampleHelpers.processEntitiesFromWikidataDump(jsonSerializationProcessor);
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"ExampleHelpers",
".",
"configureLogging",
"(",
")",
";",
"JsonSerializationProcessor",
".",
"printDocumentation",
"(",
")",
";",
"JsonSerializationProcessor",
... | Runs the example program.
@param args
@throws IOException
if there was a problem in writing the output file | [
"Runs",
"the",
"example",
"program",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java#L67-L74 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java | JsonSerializationProcessor.close | public void close() throws IOException {
System.out.println("Serialized "
+ this.jsonSerializer.getEntityDocumentCount()
+ " item documents to JSON file " + OUTPUT_FILE_NAME + ".");
this.jsonSerializer.close();
} | java | public void close() throws IOException {
System.out.println("Serialized "
+ this.jsonSerializer.getEntityDocumentCount()
+ " item documents to JSON file " + OUTPUT_FILE_NAME + ".");
this.jsonSerializer.close();
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Serialized \"",
"+",
"this",
".",
"jsonSerializer",
".",
"getEntityDocumentCount",
"(",
")",
"+",
"\" item documents to JSON file \"",
"+",
"OUTPUT_FIL... | Closes the output. Should be called after the JSON serialization was
finished.
@throws IOException
if there was a problem closing the output | [
"Closes",
"the",
"output",
".",
"Should",
"be",
"called",
"after",
"the",
"JSON",
"serialization",
"was",
"finished",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java#L147-L152 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java | JsonSerializationProcessor.includeDocument | private boolean includeDocument(ItemDocument itemDocument) {
for (StatementGroup sg : itemDocument.getStatementGroups()) {
// "P19" is "place of birth" on Wikidata
if (!"P19".equals(sg.getProperty().getId())) {
continue;
}
for (Statement s : sg) {
if (s.getMainSnak() instanceof ValueSnak) {
V... | java | private boolean includeDocument(ItemDocument itemDocument) {
for (StatementGroup sg : itemDocument.getStatementGroups()) {
// "P19" is "place of birth" on Wikidata
if (!"P19".equals(sg.getProperty().getId())) {
continue;
}
for (Statement s : sg) {
if (s.getMainSnak() instanceof ValueSnak) {
V... | [
"private",
"boolean",
"includeDocument",
"(",
"ItemDocument",
"itemDocument",
")",
"{",
"for",
"(",
"StatementGroup",
"sg",
":",
"itemDocument",
".",
"getStatementGroups",
"(",
")",
")",
"{",
"// \"P19\" is \"place of birth\" on Wikidata",
"if",
"(",
"!",
"\"P19\"",
... | Returns true if the given document should be included in the
serialization.
@param itemDocument
the document to check
@return true if the document should be serialized | [
"Returns",
"true",
"if",
"the",
"given",
"document",
"should",
"be",
"included",
"in",
"the",
"serialization",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/JsonSerializationProcessor.java#L162-L180 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.insertDumpInformation | public static String insertDumpInformation(String pattern,
String dateStamp, String project) {
if (pattern == null) {
return null;
} else {
return pattern.replace("{DATE}", dateStamp).replace("{PROJECT}",
project);
}
} | java | public static String insertDumpInformation(String pattern,
String dateStamp, String project) {
if (pattern == null) {
return null;
} else {
return pattern.replace("{DATE}", dateStamp).replace("{PROJECT}",
project);
}
} | [
"public",
"static",
"String",
"insertDumpInformation",
"(",
"String",
"pattern",
",",
"String",
"dateStamp",
",",
"String",
"project",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"pattern",
"."... | Inserts the information about the dateStamp of a dump and the project
name into a pattern.
@param pattern
String with wildcards
@param dateStamp
@param project
@return String with injected information. | [
"Inserts",
"the",
"information",
"about",
"the",
"dateStamp",
"of",
"a",
"dump",
"and",
"the",
"project",
"name",
"into",
"a",
"pattern",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L278-L286 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.handleArguments | private List<DumpProcessingAction> handleArguments(String[] args) {
CommandLine cmd;
CommandLineParser parser = new GnuParser();
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
logger.error("Failed to parse arguments: " + e.getMessage());
return Collections.emptyList();
}
//... | java | private List<DumpProcessingAction> handleArguments(String[] args) {
CommandLine cmd;
CommandLineParser parser = new GnuParser();
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
logger.error("Failed to parse arguments: " + e.getMessage());
return Collections.emptyList();
}
//... | [
"private",
"List",
"<",
"DumpProcessingAction",
">",
"handleArguments",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"CommandLine",
"cmd",
";",
"CommandLineParser",
"parser",
"=",
"new",
"GnuParser",
"(",
")",
";",
"try",
"{",
"cmd",
"=",
"parser",
".",
"par... | This function interprets the arguments of the main function. By doing
this it will set flags for the dump generation. See in the help text for
more specific information about the options.
@param args
array of arguments from the main function.
@return list of {@link DumpProcessingOutputAction} | [
"This",
"function",
"interprets",
"the",
"arguments",
"of",
"the",
"main",
"function",
".",
"By",
"doing",
"this",
"it",
"will",
"set",
"flags",
"for",
"the",
"dump",
"generation",
".",
"See",
"in",
"the",
"help",
"text",
"for",
"more",
"specific",
"inform... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L454-L496 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.handleGlobalArguments | private void handleGlobalArguments(CommandLine cmd) {
if (cmd.hasOption(CMD_OPTION_DUMP_LOCATION)) {
this.dumpDirectoryLocation = cmd
.getOptionValue(CMD_OPTION_DUMP_LOCATION);
}
if (cmd.hasOption(CMD_OPTION_OFFLINE_MODE)) {
this.offlineMode = true;
}
if (cmd.hasOption(CMD_OPTION_QUIET)) {
thi... | java | private void handleGlobalArguments(CommandLine cmd) {
if (cmd.hasOption(CMD_OPTION_DUMP_LOCATION)) {
this.dumpDirectoryLocation = cmd
.getOptionValue(CMD_OPTION_DUMP_LOCATION);
}
if (cmd.hasOption(CMD_OPTION_OFFLINE_MODE)) {
this.offlineMode = true;
}
if (cmd.hasOption(CMD_OPTION_QUIET)) {
thi... | [
"private",
"void",
"handleGlobalArguments",
"(",
"CommandLine",
"cmd",
")",
"{",
"if",
"(",
"cmd",
".",
"hasOption",
"(",
"CMD_OPTION_DUMP_LOCATION",
")",
")",
"{",
"this",
".",
"dumpDirectoryLocation",
"=",
"cmd",
".",
"getOptionValue",
"(",
"CMD_OPTION_DUMP_LOCA... | Analyses the command-line arguments which are relevant for the
serialization process in general. It fills out the class arguments with
this data.
@param cmd
{@link CommandLine} objects; contains the command line
arguments parsed by a {@link CommandLineParser} | [
"Analyses",
"the",
"command",
"-",
"line",
"arguments",
"which",
"are",
"relevant",
"for",
"the",
"serialization",
"process",
"in",
"general",
".",
"It",
"fills",
"out",
"the",
"class",
"arguments",
"with",
"this",
"data",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L543-L576 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.handleGlobalArguments | private void handleGlobalArguments(Section section) {
for (String key : section.keySet()) {
switch (key) {
case OPTION_OFFLINE_MODE:
if (section.get(key).toLowerCase().equals("true")) {
this.offlineMode = true;
}
break;
case OPTION_QUIET:
if (section.get(key).toLowerCase().equals("true")... | java | private void handleGlobalArguments(Section section) {
for (String key : section.keySet()) {
switch (key) {
case OPTION_OFFLINE_MODE:
if (section.get(key).toLowerCase().equals("true")) {
this.offlineMode = true;
}
break;
case OPTION_QUIET:
if (section.get(key).toLowerCase().equals("true")... | [
"private",
"void",
"handleGlobalArguments",
"(",
"Section",
"section",
")",
"{",
"for",
"(",
"String",
"key",
":",
"section",
".",
"keySet",
"(",
")",
")",
"{",
"switch",
"(",
"key",
")",
"{",
"case",
"OPTION_OFFLINE_MODE",
":",
"if",
"(",
"section",
"."... | Analyses the content of the general section of an ini configuration file
and fills out the class arguments with this data.
@param section
{@link Section} with name "general" | [
"Analyses",
"the",
"content",
"of",
"the",
"general",
"section",
"of",
"an",
"ini",
"configuration",
"file",
"and",
"fills",
"out",
"the",
"class",
"arguments",
"with",
"this",
"data",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L585-L620 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.checkDuplicateStdOutOutput | private void checkDuplicateStdOutOutput(DumpProcessingAction newAction) {
if (newAction.useStdOut()) {
if (this.quiet) {
logger.warn("Multiple actions are using stdout as output destination.");
}
this.quiet = true;
}
} | java | private void checkDuplicateStdOutOutput(DumpProcessingAction newAction) {
if (newAction.useStdOut()) {
if (this.quiet) {
logger.warn("Multiple actions are using stdout as output destination.");
}
this.quiet = true;
}
} | [
"private",
"void",
"checkDuplicateStdOutOutput",
"(",
"DumpProcessingAction",
"newAction",
")",
"{",
"if",
"(",
"newAction",
".",
"useStdOut",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"quiet",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Multiple actions are us... | Checks if a newly created action wants to write output to stdout, and
logs a warning if other actions are doing the same.
@param newAction
the new action to be checked | [
"Checks",
"if",
"a",
"newly",
"created",
"action",
"wants",
"to",
"write",
"output",
"to",
"stdout",
"and",
"logs",
"a",
"warning",
"if",
"other",
"actions",
"are",
"doing",
"the",
"same",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L684-L691 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.setLanguageFilters | private void setLanguageFilters(String filters) {
this.filterLanguages = new HashSet<>();
if (!"-".equals(filters)) {
Collections.addAll(this.filterLanguages, filters.split(","));
}
} | java | private void setLanguageFilters(String filters) {
this.filterLanguages = new HashSet<>();
if (!"-".equals(filters)) {
Collections.addAll(this.filterLanguages, filters.split(","));
}
} | [
"private",
"void",
"setLanguageFilters",
"(",
"String",
"filters",
")",
"{",
"this",
".",
"filterLanguages",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"\"-\"",
".",
"equals",
"(",
"filters",
")",
")",
"{",
"Collections",
".",
"addAll",
... | Sets the set of language filters based on the given string.
@param filters
comma-separates list of language codes, or "-" to filter all
languages | [
"Sets",
"the",
"set",
"of",
"language",
"filters",
"based",
"on",
"the",
"given",
"string",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L733-L738 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.setSiteFilters | private void setSiteFilters(String filters) {
this.filterSites = new HashSet<>();
if (!"-".equals(filters)) {
Collections.addAll(this.filterSites, filters.split(","));
}
} | java | private void setSiteFilters(String filters) {
this.filterSites = new HashSet<>();
if (!"-".equals(filters)) {
Collections.addAll(this.filterSites, filters.split(","));
}
} | [
"private",
"void",
"setSiteFilters",
"(",
"String",
"filters",
")",
"{",
"this",
".",
"filterSites",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"\"-\"",
".",
"equals",
"(",
"filters",
")",
")",
"{",
"Collections",
".",
"addAll",
"(",
... | Sets the set of site filters based on the given string.
@param filters
comma-separates list of site keys, or "-" to filter all site
links | [
"Sets",
"the",
"set",
"of",
"site",
"filters",
"based",
"on",
"the",
"given",
"string",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L747-L752 | train |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java | ClientConfiguration.setPropertyFilters | private void setPropertyFilters(String filters) {
this.filterProperties = new HashSet<>();
if (!"-".equals(filters)) {
for (String pid : filters.split(",")) {
this.filterProperties.add(Datamodel
.makeWikidataPropertyIdValue(pid));
}
}
} | java | private void setPropertyFilters(String filters) {
this.filterProperties = new HashSet<>();
if (!"-".equals(filters)) {
for (String pid : filters.split(",")) {
this.filterProperties.add(Datamodel
.makeWikidataPropertyIdValue(pid));
}
}
} | [
"private",
"void",
"setPropertyFilters",
"(",
"String",
"filters",
")",
"{",
"this",
".",
"filterProperties",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"\"-\"",
".",
"equals",
"(",
"filters",
")",
")",
"{",
"for",
"(",
"String",
"pid"... | Sets the set of property filters based on the given string.
@param filters
comma-separates list of property ids, or "-" to filter all
statements | [
"Sets",
"the",
"set",
"of",
"property",
"filters",
"based",
"on",
"the",
"given",
"string",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/ClientConfiguration.java#L761-L769 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.writeFinalResults | public void writeFinalResults() {
printStatus();
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("gender-ratios.csv"))) {
out.print("Site key,pages total,pages on humans,pages on humans with gender");
for (EntityIdValue gender : this.genderNamesList) {
out.print(","... | java | public void writeFinalResults() {
printStatus();
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("gender-ratios.csv"))) {
out.print("Site key,pages total,pages on humans,pages on humans with gender");
for (EntityIdValue gender : this.genderNamesList) {
out.print(","... | [
"public",
"void",
"writeFinalResults",
"(",
")",
"{",
"printStatus",
"(",
")",
";",
"try",
"(",
"PrintStream",
"out",
"=",
"new",
"PrintStream",
"(",
"ExampleHelpers",
".",
"openExampleFileOuputStream",
"(",
"\"gender-ratios.csv\"",
")",
")",
")",
"{",
"out",
... | Writes the results of the processing to a CSV file. | [
"Writes",
"the",
"results",
"of",
"the",
"processing",
"to",
"a",
"CSV",
"file",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L249-L282 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.printDocumentation | public static void printDocumentation() {
System.out
.println("********************************************************************");
System.out.println("*** Wikidata Toolkit: GenderRatioProcessor");
System.out.println("*** ");
System.out
.println("*** This program will download and process dumps from ... | java | public static void printDocumentation() {
System.out
.println("********************************************************************");
System.out.println("*** Wikidata Toolkit: GenderRatioProcessor");
System.out.println("*** ");
System.out
.println("*** This program will download and process dumps from ... | [
"public",
"static",
"void",
"printDocumentation",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"********************************************************************\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"*** Wikidata Toolkit: GenderRati... | Prints some basic documentation about this program. | [
"Prints",
"some",
"basic",
"documentation",
"about",
"this",
"program",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L287-L303 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.containsValue | private boolean containsValue(StatementGroup statementGroup, Value value) {
for (Statement s : statementGroup) {
if (value.equals(s.getValue())) {
return true;
}
}
return false;
} | java | private boolean containsValue(StatementGroup statementGroup, Value value) {
for (Statement s : statementGroup) {
if (value.equals(s.getValue())) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsValue",
"(",
"StatementGroup",
"statementGroup",
",",
"Value",
"value",
")",
"{",
"for",
"(",
"Statement",
"s",
":",
"statementGroup",
")",
"{",
"if",
"(",
"value",
".",
"equals",
"(",
"s",
".",
"getValue",
"(",
")",
")",
"... | Checks if the given group of statements contains the given value as the
value of a main snak of some statement.
@param statementGroup
the statement group to scan
@param value
the value to scan for
@return true if value was found | [
"Checks",
"if",
"the",
"given",
"group",
"of",
"statements",
"contains",
"the",
"given",
"value",
"as",
"the",
"value",
"of",
"a",
"main",
"snak",
"of",
"some",
"statement",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L397-L405 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.addNewGenderName | private void addNewGenderName(EntityIdValue entityIdValue, String name) {
this.genderNames.put(entityIdValue, name);
this.genderNamesList.add(entityIdValue);
} | java | private void addNewGenderName(EntityIdValue entityIdValue, String name) {
this.genderNames.put(entityIdValue, name);
this.genderNamesList.add(entityIdValue);
} | [
"private",
"void",
"addNewGenderName",
"(",
"EntityIdValue",
"entityIdValue",
",",
"String",
"name",
")",
"{",
"this",
".",
"genderNames",
".",
"put",
"(",
"entityIdValue",
",",
"name",
")",
";",
"this",
".",
"genderNamesList",
".",
"add",
"(",
"entityIdValue"... | Adds a new gender item and an initial name.
@param entityIdValue
the item representing the gender
@param name
the label to use for representing the gender | [
"Adds",
"a",
"new",
"gender",
"item",
"and",
"an",
"initial",
"name",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L415-L418 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.getSiteRecord | private SiteRecord getSiteRecord(String siteKey) {
SiteRecord siteRecord = this.siteRecords.get(siteKey);
if (siteRecord == null) {
siteRecord = new SiteRecord(siteKey);
this.siteRecords.put(siteKey, siteRecord);
}
return siteRecord;
} | java | private SiteRecord getSiteRecord(String siteKey) {
SiteRecord siteRecord = this.siteRecords.get(siteKey);
if (siteRecord == null) {
siteRecord = new SiteRecord(siteKey);
this.siteRecords.put(siteKey, siteRecord);
}
return siteRecord;
} | [
"private",
"SiteRecord",
"getSiteRecord",
"(",
"String",
"siteKey",
")",
"{",
"SiteRecord",
"siteRecord",
"=",
"this",
".",
"siteRecords",
".",
"get",
"(",
"siteKey",
")",
";",
"if",
"(",
"siteRecord",
"==",
"null",
")",
"{",
"siteRecord",
"=",
"new",
"Sit... | Returns a site record for the site of the given name, creating a new one
if it does not exist yet.
@param siteKey
the key of the site
@return the suitable site record | [
"Returns",
"a",
"site",
"record",
"for",
"the",
"site",
"of",
"the",
"given",
"name",
"creating",
"a",
"new",
"one",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L428-L435 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.countGender | private void countGender(EntityIdValue gender, SiteRecord siteRecord) {
Integer curValue = siteRecord.genderCounts.get(gender);
if (curValue == null) {
siteRecord.genderCounts.put(gender, 1);
} else {
siteRecord.genderCounts.put(gender, curValue + 1);
}
} | java | private void countGender(EntityIdValue gender, SiteRecord siteRecord) {
Integer curValue = siteRecord.genderCounts.get(gender);
if (curValue == null) {
siteRecord.genderCounts.put(gender, 1);
} else {
siteRecord.genderCounts.put(gender, curValue + 1);
}
} | [
"private",
"void",
"countGender",
"(",
"EntityIdValue",
"gender",
",",
"SiteRecord",
"siteRecord",
")",
"{",
"Integer",
"curValue",
"=",
"siteRecord",
".",
"genderCounts",
".",
"get",
"(",
"gender",
")",
";",
"if",
"(",
"curValue",
"==",
"null",
")",
"{",
... | Counts a single page of the specified gender. If this is the first page
of that gender on this site, a suitable key is added to the list of the
site's genders.
@param gender
the gender to count
@param siteRecord
the site record to count it for | [
"Counts",
"a",
"single",
"page",
"of",
"the",
"specified",
"gender",
".",
"If",
"this",
"is",
"the",
"first",
"page",
"of",
"that",
"gender",
"on",
"this",
"site",
"a",
"suitable",
"key",
"is",
"added",
"to",
"the",
"list",
"of",
"the",
"site",
"s",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L447-L454 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbSearchEntitiesAction.java | WbSearchEntitiesAction.wbSearchEntities | public List<WbSearchEntitiesResult> wbSearchEntities(String search, String language,
Boolean strictLanguage, String type, Long limit, Long offset)
throws MediaWikiApiErrorException {
Map<String, String> parameters = new HashMap<String, String... | java | public List<WbSearchEntitiesResult> wbSearchEntities(String search, String language,
Boolean strictLanguage, String type, Long limit, Long offset)
throws MediaWikiApiErrorException {
Map<String, String> parameters = new HashMap<String, String... | [
"public",
"List",
"<",
"WbSearchEntitiesResult",
">",
"wbSearchEntities",
"(",
"String",
"search",
",",
"String",
"language",
",",
"Boolean",
"strictLanguage",
",",
"String",
"type",
",",
"Long",
"limit",
",",
"Long",
"offset",
")",
"throws",
"MediaWikiApiErrorExc... | Executes the API action "wbsearchentity" for the given parameters.
Searches for entities using labels and aliases. Returns a label and
description for the entity in the user language if possible. Returns
details of the matched term. The matched term text is also present in the
aliases key if different from the display ... | [
"Executes",
"the",
"API",
"action",
"wbsearchentity",
"for",
"the",
"given",
"parameters",
".",
"Searches",
"for",
"entities",
"using",
"labels",
"and",
"aliases",
".",
"Returns",
"a",
"label",
"and",
"description",
"for",
"the",
"entity",
"in",
"the",
"user",... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbSearchEntitiesAction.java#L125-L182 | train |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/ItemDocumentBuilder.java | ItemDocumentBuilder.withSiteLink | public ItemDocumentBuilder withSiteLink(String title, String siteKey,
ItemIdValue... badges) {
withSiteLink(factory.getSiteLink(title, siteKey, Arrays.asList(badges)));
return this;
} | java | public ItemDocumentBuilder withSiteLink(String title, String siteKey,
ItemIdValue... badges) {
withSiteLink(factory.getSiteLink(title, siteKey, Arrays.asList(badges)));
return this;
} | [
"public",
"ItemDocumentBuilder",
"withSiteLink",
"(",
"String",
"title",
",",
"String",
"siteKey",
",",
"ItemIdValue",
"...",
"badges",
")",
"{",
"withSiteLink",
"(",
"factory",
".",
"getSiteLink",
"(",
"title",
",",
"siteKey",
",",
"Arrays",
".",
"asList",
"(... | Adds an additional site link to the constructed document.
@param title
the title of the linked page
@param siteKey
identifier of the site, e.g., "enwiki"
@param badges
one or more badges | [
"Adds",
"an",
"additional",
"site",
"link",
"to",
"the",
"constructed",
"document",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/ItemDocumentBuilder.java#L121-L125 | train |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/ReferenceRdfConverter.java | ReferenceRdfConverter.addReference | public Resource addReference(Reference reference) {
Resource resource = this.rdfWriter.getUri(Vocabulary.getReferenceUri(reference));
this.referenceQueue.add(reference);
this.referenceSubjectQueue.add(resource);
return resource;
} | java | public Resource addReference(Reference reference) {
Resource resource = this.rdfWriter.getUri(Vocabulary.getReferenceUri(reference));
this.referenceQueue.add(reference);
this.referenceSubjectQueue.add(resource);
return resource;
} | [
"public",
"Resource",
"addReference",
"(",
"Reference",
"reference",
")",
"{",
"Resource",
"resource",
"=",
"this",
".",
"rdfWriter",
".",
"getUri",
"(",
"Vocabulary",
".",
"getReferenceUri",
"(",
"reference",
")",
")",
";",
"this",
".",
"referenceQueue",
".",... | Adds the given reference to the list of references that should still be
serialized, and returns the RDF resource that will be used as a subject.
@param reference
the reference to be serialized
@return RDF resource that represents this reference | [
"Adds",
"the",
"given",
"reference",
"to",
"the",
"list",
"of",
"references",
"that",
"should",
"still",
"be",
"serialized",
"and",
"returns",
"the",
"RDF",
"resource",
"that",
"will",
"be",
"used",
"as",
"a",
"subject",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/ReferenceRdfConverter.java#L75-L82 | train |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/ReferenceRdfConverter.java | ReferenceRdfConverter.writeReferences | public void writeReferences() throws RDFHandlerException {
Iterator<Reference> referenceIterator = this.referenceQueue.iterator();
for (Resource resource : this.referenceSubjectQueue) {
final Reference reference = referenceIterator.next();
if (this.declaredReferences.add(resource)) {
writeReference(refere... | java | public void writeReferences() throws RDFHandlerException {
Iterator<Reference> referenceIterator = this.referenceQueue.iterator();
for (Resource resource : this.referenceSubjectQueue) {
final Reference reference = referenceIterator.next();
if (this.declaredReferences.add(resource)) {
writeReference(refere... | [
"public",
"void",
"writeReferences",
"(",
")",
"throws",
"RDFHandlerException",
"{",
"Iterator",
"<",
"Reference",
">",
"referenceIterator",
"=",
"this",
".",
"referenceQueue",
".",
"iterator",
"(",
")",
";",
"for",
"(",
"Resource",
"resource",
":",
"this",
".... | Writes references that have been added recently. Auxiliary triples that
are generated for serializing snaks in references will be written right
afterwards. This will also trigger any other auxiliary triples to be
written that the snak converter object may have buffered.
@throws RDFHandlerException
if there was a probl... | [
"Writes",
"references",
"that",
"have",
"been",
"added",
"recently",
".",
"Auxiliary",
"triples",
"that",
"are",
"generated",
"for",
"serializing",
"snaks",
"in",
"references",
"will",
"be",
"written",
"right",
"afterwards",
".",
"This",
"will",
"also",
"trigger... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/ReferenceRdfConverter.java#L93-L105 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java | DumpProcessingController.getSitesInformation | public Sites getSitesInformation() throws IOException {
MwDumpFile sitesTableDump = getMostRecentDump(DumpContentType.SITES);
if (sitesTableDump == null) {
return null;
}
// Create a suitable processor for such dumps and process the file:
MwSitesDumpFileProcessor sitesDumpFileProcessor = new MwSitesDumpFi... | java | public Sites getSitesInformation() throws IOException {
MwDumpFile sitesTableDump = getMostRecentDump(DumpContentType.SITES);
if (sitesTableDump == null) {
return null;
}
// Create a suitable processor for such dumps and process the file:
MwSitesDumpFileProcessor sitesDumpFileProcessor = new MwSitesDumpFi... | [
"public",
"Sites",
"getSitesInformation",
"(",
")",
"throws",
"IOException",
"{",
"MwDumpFile",
"sitesTableDump",
"=",
"getMostRecentDump",
"(",
"DumpContentType",
".",
"SITES",
")",
";",
"if",
"(",
"sitesTableDump",
"==",
"null",
")",
"{",
"return",
"null",
";"... | Processes the most recent dump of the sites table to extract information
about registered sites.
@return a Sites objects that contains the extracted information, or null
if no sites dump was available (typically in offline mode without
having any previously downloaded sites dumps)
@throws IOException
if there was a pr... | [
"Processes",
"the",
"most",
"recent",
"dump",
"of",
"the",
"sites",
"table",
"to",
"extract",
"information",
"about",
"registered",
"sites",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java#L347-L359 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java | DumpProcessingController.processMostRecentDump | @Deprecated
public void processMostRecentDump(DumpContentType dumpContentType,
MwDumpFileProcessor dumpFileProcessor) {
MwDumpFile dumpFile = getMostRecentDump(dumpContentType);
if (dumpFile != null) {
processDumpFile(dumpFile, dumpFileProcessor);
}
} | java | @Deprecated
public void processMostRecentDump(DumpContentType dumpContentType,
MwDumpFileProcessor dumpFileProcessor) {
MwDumpFile dumpFile = getMostRecentDump(dumpContentType);
if (dumpFile != null) {
processDumpFile(dumpFile, dumpFileProcessor);
}
} | [
"@",
"Deprecated",
"public",
"void",
"processMostRecentDump",
"(",
"DumpContentType",
"dumpContentType",
",",
"MwDumpFileProcessor",
"dumpFileProcessor",
")",
"{",
"MwDumpFile",
"dumpFile",
"=",
"getMostRecentDump",
"(",
"dumpContentType",
")",
";",
"if",
"(",
"dumpFile... | Processes the most recent dump of the given type using the given dump
processor.
@see DumpProcessingController#processMostRecentMainDump()
@see DumpProcessingController#processAllRecentRevisionDumps()
@param dumpContentType
the type of dump to process
@param dumpFileProcessor
the processor to use
@deprecated Use {@li... | [
"Processes",
"the",
"most",
"recent",
"dump",
"of",
"the",
"given",
"type",
"using",
"the",
"given",
"dump",
"processor",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java#L496-L503 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java | DumpProcessingController.processDumpFile | void processDumpFile(MwDumpFile dumpFile,
MwDumpFileProcessor dumpFileProcessor) {
try (InputStream inputStream = dumpFile.getDumpFileStream()) {
dumpFileProcessor.processDumpFileContents(inputStream, dumpFile);
} catch (FileAlreadyExistsException e) {
logger.error("Dump file "
+ dumpFile.toString()
... | java | void processDumpFile(MwDumpFile dumpFile,
MwDumpFileProcessor dumpFileProcessor) {
try (InputStream inputStream = dumpFile.getDumpFileStream()) {
dumpFileProcessor.processDumpFileContents(inputStream, dumpFile);
} catch (FileAlreadyExistsException e) {
logger.error("Dump file "
+ dumpFile.toString()
... | [
"void",
"processDumpFile",
"(",
"MwDumpFile",
"dumpFile",
",",
"MwDumpFileProcessor",
"dumpFileProcessor",
")",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"dumpFile",
".",
"getDumpFileStream",
"(",
")",
")",
"{",
"dumpFileProcessor",
".",
"processDumpFileCont... | Processes one dump file with the given dump file processor, handling
exceptions appropriately.
@param dumpFile
the dump file to process
@param dumpFileProcessor
the dump file processor to use | [
"Processes",
"one",
"dump",
"file",
"with",
"the",
"given",
"dump",
"file",
"processor",
"handling",
"exceptions",
"appropriately",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/DumpProcessingController.java#L538-L552 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java | WmfDumpFileManager.findMostRecentDump | public MwDumpFile findMostRecentDump(DumpContentType dumpContentType) {
List<MwDumpFile> dumps = findAllDumps(dumpContentType);
for (MwDumpFile dump : dumps) {
if (dump.isAvailable()) {
return dump;
}
}
return null;
} | java | public MwDumpFile findMostRecentDump(DumpContentType dumpContentType) {
List<MwDumpFile> dumps = findAllDumps(dumpContentType);
for (MwDumpFile dump : dumps) {
if (dump.isAvailable()) {
return dump;
}
}
return null;
} | [
"public",
"MwDumpFile",
"findMostRecentDump",
"(",
"DumpContentType",
"dumpContentType",
")",
"{",
"List",
"<",
"MwDumpFile",
">",
"dumps",
"=",
"findAllDumps",
"(",
"dumpContentType",
")",
";",
"for",
"(",
"MwDumpFile",
"dump",
":",
"dumps",
")",
"{",
"if",
"... | Finds the most recent dump of the given type that is actually available.
@param dumpContentType
the type of the dump to look for
@return most recent main dump or null if no such dump exists | [
"Finds",
"the",
"most",
"recent",
"dump",
"of",
"the",
"given",
"type",
"that",
"is",
"actually",
"available",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java#L177-L186 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java | WmfDumpFileManager.mergeDumpLists | List<MwDumpFile> mergeDumpLists(List<MwDumpFile> localDumps,
List<MwDumpFile> onlineDumps) {
List<MwDumpFile> result = new ArrayList<>(localDumps);
HashSet<String> localDateStamps = new HashSet<>();
for (MwDumpFile dumpFile : localDumps) {
localDateStamps.add(dumpFile.getDateStamp());
}
for (MwDumpFile... | java | List<MwDumpFile> mergeDumpLists(List<MwDumpFile> localDumps,
List<MwDumpFile> onlineDumps) {
List<MwDumpFile> result = new ArrayList<>(localDumps);
HashSet<String> localDateStamps = new HashSet<>();
for (MwDumpFile dumpFile : localDumps) {
localDateStamps.add(dumpFile.getDateStamp());
}
for (MwDumpFile... | [
"List",
"<",
"MwDumpFile",
">",
"mergeDumpLists",
"(",
"List",
"<",
"MwDumpFile",
">",
"localDumps",
",",
"List",
"<",
"MwDumpFile",
">",
"onlineDumps",
")",
"{",
"List",
"<",
"MwDumpFile",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"localDumps",
"... | Merges a list of local and online dumps. For dumps available both online
and locally, only the local version is included. The list is order with
most recent dump date first.
@return a merged list of dump files | [
"Merges",
"a",
"list",
"of",
"local",
"and",
"online",
"dumps",
".",
"For",
"dumps",
"available",
"both",
"online",
"and",
"locally",
"only",
"the",
"local",
"version",
"is",
"included",
".",
"The",
"list",
"is",
"order",
"with",
"most",
"recent",
"dump",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java#L215-L230 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java | WmfDumpFileManager.findDumpsLocally | List<MwDumpFile> findDumpsLocally(DumpContentType dumpContentType) {
String directoryPattern = WmfDumpFile.getDumpFileDirectoryName(
dumpContentType, "*");
List<String> dumpFileDirectories;
try {
dumpFileDirectories = this.dumpfileDirectoryManager
.getSubdirectories(directoryPattern);
} catch (IOE... | java | List<MwDumpFile> findDumpsLocally(DumpContentType dumpContentType) {
String directoryPattern = WmfDumpFile.getDumpFileDirectoryName(
dumpContentType, "*");
List<String> dumpFileDirectories;
try {
dumpFileDirectories = this.dumpfileDirectoryManager
.getSubdirectories(directoryPattern);
} catch (IOE... | [
"List",
"<",
"MwDumpFile",
">",
"findDumpsLocally",
"(",
"DumpContentType",
"dumpContentType",
")",
"{",
"String",
"directoryPattern",
"=",
"WmfDumpFile",
".",
"getDumpFileDirectoryName",
"(",
"dumpContentType",
",",
"\"*\"",
")",
";",
"List",
"<",
"String",
">",
... | Finds out which dump files of the given type have been downloaded
already. The result is a list of objects that describe the available dump
files, in descending order by their date. Not all of the dumps included
might be actually available.
@param dumpContentType
the type of dump to consider
@return list of objects th... | [
"Finds",
"out",
"which",
"dump",
"files",
"of",
"the",
"given",
"type",
"have",
"been",
"downloaded",
"already",
".",
"The",
"result",
"is",
"a",
"list",
"of",
"objects",
"that",
"describe",
"the",
"available",
"dump",
"files",
"in",
"descending",
"order",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java#L242-L282 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java | WmfDumpFileManager.findDumpsOnline | List<MwDumpFile> findDumpsOnline(DumpContentType dumpContentType) {
List<String> dumpFileDates = findDumpDatesOnline(dumpContentType);
List<MwDumpFile> result = new ArrayList<>();
for (String dateStamp : dumpFileDates) {
if (dumpContentType == DumpContentType.DAILY) {
result.add(new WmfOnlineDailyDumpFil... | java | List<MwDumpFile> findDumpsOnline(DumpContentType dumpContentType) {
List<String> dumpFileDates = findDumpDatesOnline(dumpContentType);
List<MwDumpFile> result = new ArrayList<>();
for (String dateStamp : dumpFileDates) {
if (dumpContentType == DumpContentType.DAILY) {
result.add(new WmfOnlineDailyDumpFil... | [
"List",
"<",
"MwDumpFile",
">",
"findDumpsOnline",
"(",
"DumpContentType",
"dumpContentType",
")",
"{",
"List",
"<",
"String",
">",
"dumpFileDates",
"=",
"findDumpDatesOnline",
"(",
"dumpContentType",
")",
";",
"List",
"<",
"MwDumpFile",
">",
"result",
"=",
"new... | Finds out which dump files of the given type are available for download.
The result is a list of objects that describe the available dump files,
in descending order by their date. Not all of the dumps included might be
actually available.
@return list of objects that provide information on available full dumps | [
"Finds",
"out",
"which",
"dump",
"files",
"of",
"the",
"given",
"type",
"are",
"available",
"for",
"download",
".",
"The",
"result",
"is",
"a",
"list",
"of",
"objects",
"that",
"describe",
"the",
"available",
"dump",
"files",
"in",
"descending",
"order",
"... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java#L292-L316 | train |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/TutorialDocumentProcessor.java | TutorialDocumentProcessor.processItemDocument | @Override
public void processItemDocument(ItemDocument itemDocument) {
this.countItems++;
// Do some printing for demonstration/debugging.
// Only print at most 50 items (or it would get too slow).
if (this.countItems < 10) {
System.out.println(itemDocument);
} else if (this.countItems == 10) {
System... | java | @Override
public void processItemDocument(ItemDocument itemDocument) {
this.countItems++;
// Do some printing for demonstration/debugging.
// Only print at most 50 items (or it would get too slow).
if (this.countItems < 10) {
System.out.println(itemDocument);
} else if (this.countItems == 10) {
System... | [
"@",
"Override",
"public",
"void",
"processItemDocument",
"(",
"ItemDocument",
"itemDocument",
")",
"{",
"this",
".",
"countItems",
"++",
";",
"// Do some printing for demonstration/debugging.",
"// Only print at most 50 items (or it would get too slow).",
"if",
"(",
"this",
... | Processes one item document. This is often the main workhorse that
gathers the data you are interested in. You can modify this code as you
wish. | [
"Processes",
"one",
"item",
"document",
".",
"This",
"is",
"often",
"the",
"main",
"workhorse",
"that",
"gathers",
"the",
"data",
"you",
"are",
"interested",
"in",
".",
"You",
"can",
"modify",
"this",
"code",
"as",
"you",
"wish",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/TutorialDocumentProcessor.java#L106-L119 | train |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java | EntityIdValueImpl.fromId | static EntityIdValue fromId(String id, String siteIri) {
switch (guessEntityTypeFromId(id)) {
case EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:
return new ItemIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:
return new PropertyIdValueImpl(id, siteIri);
case EntityIdValueImpl.JS... | java | static EntityIdValue fromId(String id, String siteIri) {
switch (guessEntityTypeFromId(id)) {
case EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:
return new ItemIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:
return new PropertyIdValueImpl(id, siteIri);
case EntityIdValueImpl.JS... | [
"static",
"EntityIdValue",
"fromId",
"(",
"String",
"id",
",",
"String",
"siteIri",
")",
"{",
"switch",
"(",
"guessEntityTypeFromId",
"(",
"id",
")",
")",
"{",
"case",
"EntityIdValueImpl",
".",
"JSON_ENTITY_TYPE_ITEM",
":",
"return",
"new",
"ItemIdValueImpl",
"(... | Parses an item id
@param id
the identifier of the entity, such as "Q42"
@param siteIri
the siteIRI that this value refers to
@throws IllegalArgumentException
if the id is invalid | [
"Parses",
"an",
"item",
"id"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java#L117-L132 | train |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java | EntityIdValueImpl.guessEntityTypeFromId | static String guessEntityTypeFromId(String id) {
if(id.isEmpty()) {
throw new IllegalArgumentException("Entity ids should not be empty.");
}
switch (id.charAt(0)) {
case 'L':
if(id.contains("-F")) {
return JSON_ENTITY_TYPE_FORM;
} else if(id.contains("-S")) {
return JSON_ENTITY_TYPE_SENSE;... | java | static String guessEntityTypeFromId(String id) {
if(id.isEmpty()) {
throw new IllegalArgumentException("Entity ids should not be empty.");
}
switch (id.charAt(0)) {
case 'L':
if(id.contains("-F")) {
return JSON_ENTITY_TYPE_FORM;
} else if(id.contains("-S")) {
return JSON_ENTITY_TYPE_SENSE;... | [
"static",
"String",
"guessEntityTypeFromId",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Entity ids should not be empty.\"",
")",
";",
"}",
"switch",
"(",
"id",
".",
... | RReturns the entity type of the id like "item" or "property"
@param id
the identifier of the entity, such as "Q42"
@throws IllegalArgumentException
if the id is invalid | [
"RReturns",
"the",
"entity",
"type",
"of",
"the",
"id",
"like",
"item",
"or",
"property"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java#L142-L162 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/EntityTimerProcessor.java | EntityTimerProcessor.close | @Override
public void close() {
logger.info("Finished processing.");
this.timer.stop();
this.lastSeconds = (int) (timer.getTotalWallTime() / 1000000000);
printStatus();
} | java | @Override
public void close() {
logger.info("Finished processing.");
this.timer.stop();
this.lastSeconds = (int) (timer.getTotalWallTime() / 1000000000);
printStatus();
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"logger",
".",
"info",
"(",
"\"Finished processing.\"",
")",
";",
"this",
".",
"timer",
".",
"stop",
"(",
")",
";",
"this",
".",
"lastSeconds",
"=",
"(",
"int",
")",
"(",
"timer",
".",
"getTo... | Stops the processing and prints the final time. | [
"Stops",
"the",
"processing",
"and",
"prints",
"the",
"final",
"time",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/EntityTimerProcessor.java#L108-L114 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/EntityTimerProcessor.java | EntityTimerProcessor.countEntity | private void countEntity() {
if (!this.timer.isRunning()) {
startTimer();
}
this.entityCount++;
if (this.entityCount % 100 == 0) {
timer.stop();
int seconds = (int) (timer.getTotalWallTime() / 1000000000);
if (seconds >= this.lastSeconds + this.reportInterval) {
this.lastSeconds = seconds;
... | java | private void countEntity() {
if (!this.timer.isRunning()) {
startTimer();
}
this.entityCount++;
if (this.entityCount % 100 == 0) {
timer.stop();
int seconds = (int) (timer.getTotalWallTime() / 1000000000);
if (seconds >= this.lastSeconds + this.reportInterval) {
this.lastSeconds = seconds;
... | [
"private",
"void",
"countEntity",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"timer",
".",
"isRunning",
"(",
")",
")",
"{",
"startTimer",
"(",
")",
";",
"}",
"this",
".",
"entityCount",
"++",
";",
"if",
"(",
"this",
".",
"entityCount",
"%",
"100",... | Counts one entity. Every once in a while, the current time is checked so
as to print an intermediate report roughly every ten seconds. | [
"Counts",
"one",
"entity",
".",
"Every",
"once",
"in",
"a",
"while",
"the",
"current",
"time",
"is",
"checked",
"so",
"as",
"to",
"print",
"an",
"intermediate",
"report",
"roughly",
"every",
"ten",
"seconds",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/EntityTimerProcessor.java#L120-L139 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.implodeObjects | public static String implodeObjects(Iterable<?> objects) {
StringBuilder builder = new StringBuilder();
boolean first = true;
for (Object o : objects) {
if (first) {
first = false;
} else {
builder.append("|");
}
builder.append(o.toString());
}
return builder.toString();
} | java | public static String implodeObjects(Iterable<?> objects) {
StringBuilder builder = new StringBuilder();
boolean first = true;
for (Object o : objects) {
if (first) {
first = false;
} else {
builder.append("|");
}
builder.append(o.toString());
}
return builder.toString();
} | [
"public",
"static",
"String",
"implodeObjects",
"(",
"Iterable",
"<",
"?",
">",
"objects",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Object",
"o",
":",
"objects",
... | Builds a string that serializes a list of objects separated by the pipe
character. The toString methods are used to turn objects into strings.
This operation is commonly used to build parameter lists for API
requests.
@param objects
the objects to implode
@return string of imploded objects | [
"Builds",
"a",
"string",
"that",
"serializes",
"a",
"list",
"of",
"objects",
"separated",
"by",
"the",
"pipe",
"character",
".",
"The",
"toString",
"methods",
"are",
"used",
"to",
"turn",
"objects",
"into",
"strings",
".",
"This",
"operation",
"is",
"commonl... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L266-L278 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.logout | public void logout() throws IOException {
if (this.loggedIn) {
Map<String, String> params = new HashMap<>();
params.put("action", "logout");
params.put("format", "json"); // reduce the output
try {
sendJsonRequest("POST", params);
} catch (MediaWikiApiErrorException e) {
throw new IOException(e... | java | public void logout() throws IOException {
if (this.loggedIn) {
Map<String, String> params = new HashMap<>();
params.put("action", "logout");
params.put("format", "json"); // reduce the output
try {
sendJsonRequest("POST", params);
} catch (MediaWikiApiErrorException e) {
throw new IOException(e... | [
"public",
"void",
"logout",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"loggedIn",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"action\"",... | Logs the current user out.
@throws IOException | [
"Logs",
"the",
"current",
"user",
"out",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L333-L348 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.fetchToken | String fetchToken(String tokenType) throws IOException, MediaWikiApiErrorException {
Map<String, String> params = new HashMap<>();
params.put(ApiConnection.PARAM_ACTION, "query");
params.put("meta", "tokens");
params.put("type", tokenType);
try {
JsonNode root = this.sendJsonRequest("POST", params);
re... | java | String fetchToken(String tokenType) throws IOException, MediaWikiApiErrorException {
Map<String, String> params = new HashMap<>();
params.put(ApiConnection.PARAM_ACTION, "query");
params.put("meta", "tokens");
params.put("type", tokenType);
try {
JsonNode root = this.sendJsonRequest("POST", params);
re... | [
"String",
"fetchToken",
"(",
"String",
"tokenType",
")",
"throws",
"IOException",
",",
"MediaWikiApiErrorException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"ApiConnectio... | Executes a API query action to get a new token.
The method only executes the action, without doing any
checks first. If errors occur, they are logged and null is returned.
@param tokenType The kind of token to retrieve like "csrf" or "login"
@return newly retrieved token or null if no token was retrieved | [
"Executes",
"a",
"API",
"query",
"action",
"to",
"get",
"a",
"new",
"token",
".",
"The",
"method",
"only",
"executes",
"the",
"action",
"without",
"doing",
"any",
"checks",
"first",
".",
"If",
"errors",
"occur",
"they",
"are",
"logged",
"and",
"null",
"i... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L368-L381 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.sendRequest | public InputStream sendRequest(String requestMethod,
Map<String, String> parameters) throws IOException {
String queryString = getQueryString(parameters);
URL url = new URL(this.apiBaseUrl);
HttpURLConnection connection = (HttpURLConnection) WebResourceFetcherImpl
.getUrlConnection(url);
setupConnection... | java | public InputStream sendRequest(String requestMethod,
Map<String, String> parameters) throws IOException {
String queryString = getQueryString(parameters);
URL url = new URL(this.apiBaseUrl);
HttpURLConnection connection = (HttpURLConnection) WebResourceFetcherImpl
.getUrlConnection(url);
setupConnection... | [
"public",
"InputStream",
"sendRequest",
"(",
"String",
"requestMethod",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throws",
"IOException",
"{",
"String",
"queryString",
"=",
"getQueryString",
"(",
"parameters",
")",
";",
"URL",
"url",
"... | Sends a request to the API with the given parameters and the given
request method and returns the result string. It automatically fills the
cookie map with cookies in the result header after the request.
Warning: You probably want to use ApiConnection.sendJsonRequest
that execute the request using JSON content format,... | [
"Sends",
"a",
"request",
"to",
"the",
"API",
"with",
"the",
"given",
"parameters",
"and",
"the",
"given",
"request",
"method",
"and",
"returns",
"the",
"result",
"string",
".",
"It",
"automatically",
"fills",
"the",
"cookie",
"map",
"with",
"cookies",
"in",
... | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L429-L451 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.getWarnings | List<String> getWarnings(JsonNode root) {
ArrayList<String> warnings = new ArrayList<>();
if (root.has("warnings")) {
JsonNode warningNode = root.path("warnings");
Iterator<Map.Entry<String, JsonNode>> moduleIterator = warningNode
.fields();
while (moduleIterator.hasNext()) {
Map.Entry<String, Js... | java | List<String> getWarnings(JsonNode root) {
ArrayList<String> warnings = new ArrayList<>();
if (root.has("warnings")) {
JsonNode warningNode = root.path("warnings");
Iterator<Map.Entry<String, JsonNode>> moduleIterator = warningNode
.fields();
while (moduleIterator.hasNext()) {
Map.Entry<String, Js... | [
"List",
"<",
"String",
">",
"getWarnings",
"(",
"JsonNode",
"root",
")",
"{",
"ArrayList",
"<",
"String",
">",
"warnings",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"root",
".",
"has",
"(",
"\"warnings\"",
")",
")",
"{",
"JsonNode",
"w... | Extracts warnings that are returned in an API response.
@param root
root node of the JSON result | [
"Extracts",
"warnings",
"that",
"are",
"returned",
"in",
"an",
"API",
"response",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L510-L550 | train |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java | ApiConnection.getQueryString | String getQueryString(Map<String, String> params) {
StringBuilder builder = new StringBuilder();
try {
boolean first = true;
for (Map.Entry<String,String> entry : params.entrySet()) {
if (first) {
first = false;
} else {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.g... | java | String getQueryString(Map<String, String> params) {
StringBuilder builder = new StringBuilder();
try {
boolean first = true;
for (Map.Entry<String,String> entry : params.entrySet()) {
if (first) {
first = false;
} else {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.g... | [
"String",
"getQueryString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Map",
".",
"Entry",
"<... | Returns the query string of a URL from a parameter list.
@param params
Map with parameters
@return query string | [
"Returns",
"the",
"query",
"string",
"of",
"a",
"URL",
"from",
"a",
"parameter",
"list",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L696-L716 | train |
actframework/actframework | src/main/java/act/inject/util/ResourceLoader.java | ResourceLoader.load | public static <T> T load(String resourcePath, BeanSpec spec) {
return load(resourcePath, spec, false);
} | java | public static <T> T load(String resourcePath, BeanSpec spec) {
return load(resourcePath, spec, false);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"load",
"(",
"String",
"resourcePath",
",",
"BeanSpec",
"spec",
")",
"{",
"return",
"load",
"(",
"resourcePath",
",",
"spec",
",",
"false",
")",
";",
"}"
] | Load resource content from given path into variable with
type specified by `spec`.
@param resourcePath the resource path
@param spec {@link BeanSpec} specifies the return value type
@return the resource content in a specified type or `null` if resource not found
@throws UnexpectedException if return value type not sup... | [
"Load",
"resource",
"content",
"from",
"given",
"path",
"into",
"variable",
"with",
"type",
"specified",
"by",
"spec",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/inject/util/ResourceLoader.java#L137-L139 | train |
actframework/actframework | src/main/java/act/util/LogSupport.java | LogSupport.printCenter | protected void printCenter(String format, Object... args) {
String text = S.fmt(format, args);
info(S.center(text, 80));
} | java | protected void printCenter(String format, Object... args) {
String text = S.fmt(format, args);
info(S.center(text, 80));
} | [
"protected",
"void",
"printCenter",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"text",
"=",
"S",
".",
"fmt",
"(",
"format",
",",
"args",
")",
";",
"info",
"(",
"S",
".",
"center",
"(",
"text",
",",
"80",
")",
")",
... | Print formatted string in the center of 80 chars line, left and right padded.
@param format
The string format pattern
@param args
The string format arguments | [
"Print",
"formatted",
"string",
"in",
"the",
"center",
"of",
"80",
"chars",
"line",
"left",
"and",
"right",
"padded",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/LogSupport.java#L95-L98 | train |
actframework/actframework | src/main/java/act/util/LogSupport.java | LogSupport.printCenterWithLead | protected void printCenterWithLead(String lead, String format, Object ... args) {
String text = S.fmt(format, args);
int len = 80 - lead.length();
info(S.concat(lead, S.center(text, len)));
} | java | protected void printCenterWithLead(String lead, String format, Object ... args) {
String text = S.fmt(format, args);
int len = 80 - lead.length();
info(S.concat(lead, S.center(text, len)));
} | [
"protected",
"void",
"printCenterWithLead",
"(",
"String",
"lead",
",",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"text",
"=",
"S",
".",
"fmt",
"(",
"format",
",",
"args",
")",
";",
"int",
"len",
"=",
"80",
"-",
"lead",
".... | Print the lead string followed by centered formatted string. The whole
length of the line is 80 chars.
Example:
```java
printCenterWithLead(" *", "Hello %s", "World");
```
will print something like
```
* Hello World
```
Note the above is just a demo, the exact number of whitespace might not be correct... | [
"Print",
"the",
"lead",
"string",
"followed",
"by",
"centered",
"formatted",
"string",
".",
"The",
"whole",
"length",
"of",
"the",
"line",
"is",
"80",
"chars",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/LogSupport.java#L126-L130 | train |
actframework/actframework | src/main/java/ascii/Image2ascii.java | Image2ascii.convert | public String convert(BufferedImage image, boolean favicon) {
// Reset statistics before anything
statsArray = new int[12];
// Begin the timer
dStart = System.nanoTime();
// Scale the image
image = scale(image, favicon);
// The +1 is for the newline characters
... | java | public String convert(BufferedImage image, boolean favicon) {
// Reset statistics before anything
statsArray = new int[12];
// Begin the timer
dStart = System.nanoTime();
// Scale the image
image = scale(image, favicon);
// The +1 is for the newline characters
... | [
"public",
"String",
"convert",
"(",
"BufferedImage",
"image",
",",
"boolean",
"favicon",
")",
"{",
"// Reset statistics before anything",
"statsArray",
"=",
"new",
"int",
"[",
"12",
"]",
";",
"// Begin the timer",
"dStart",
"=",
"System",
".",
"nanoTime",
"(",
"... | The main conversion method.
@param image A BufferedImage containing the image that needs to be converted
@param favicon When ico is true it will convert ico file into 16 x 16 size
@return A string containing the ASCII version of the original image. | [
"The",
"main",
"conversion",
"method",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/ascii/Image2ascii.java#L53-L79 | train |
actframework/actframework | src/main/java/ascii/Image2ascii.java | Image2ascii.scale | private static BufferedImage scale(BufferedImage imageToScale, int dWidth, int dHeight, double fWidth, double fHeight) {
BufferedImage dbi = null;
// Needed to create a new BufferedImage object
int imageType = imageToScale.getType();
if (imageToScale != null) {
dbi = new Buff... | java | private static BufferedImage scale(BufferedImage imageToScale, int dWidth, int dHeight, double fWidth, double fHeight) {
BufferedImage dbi = null;
// Needed to create a new BufferedImage object
int imageType = imageToScale.getType();
if (imageToScale != null) {
dbi = new Buff... | [
"private",
"static",
"BufferedImage",
"scale",
"(",
"BufferedImage",
"imageToScale",
",",
"int",
"dWidth",
",",
"int",
"dHeight",
",",
"double",
"fWidth",
",",
"double",
"fHeight",
")",
"{",
"BufferedImage",
"dbi",
"=",
"null",
";",
"// Needed to create a new Buff... | Image scale method
@param imageToScale The image to be scaled
@param dWidth Desired width, the new image object is created to this size
@param dHeight Desired height, the new image object is created to this size
@param fWidth What to multiply the width by. value < 1 scales down, and value > one scales up
@param fHeight... | [
"Image",
"scale",
"method"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/ascii/Image2ascii.java#L91-L102 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emit | public EventBus emit(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | java | public EventBus emit(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | [
"public",
"EventBus",
"emit",
"(",
"Enum",
"<",
"?",
">",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContext",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an enum event with parameters supplied.
This will invoke all {@link SimpleEventListener} bound to the specific
enum value and all {@link SimpleEventListener} bound to the enum class
given the listeners has the matching argument list.
For example, given the following enum definition:
```java
public enum UserActi... | [
"Emit",
"an",
"enum",
"event",
"with",
"parameters",
"supplied",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L865-L867 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emit | public EventBus emit(String event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | java | public EventBus emit(String event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | [
"public",
"EventBus",
"emit",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContext",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters.
This will invoke all {@link SimpleEventListener} bound to the specified
string value given the listeners has the matching argument list.
For example, suppose we have the following simple event listener methods:
```java
{@literal @}On("USER-LOGIN")
public void logUserLogin(User us... | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L909-L911 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emit | public EventBus emit(EventObject event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | java | public EventBus emit(EventObject event, Object... args) {
return _emitWithOnceBus(eventContext(event, args));
} | [
"public",
"EventBus",
"emit",
"(",
"EventObject",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContext",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an event object with parameters.
This will invoke all {@link SimpleEventListener} bound to the event object
class given the listeners has the matching argument list.
If there is no parameter passed in, i.e. `args.length == 0`, then it will
also invoke all the {@link ActEventListener} bound to the event class.
F... | [
"Emit",
"an",
"event",
"object",
"with",
"parameters",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L966-L968 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"Enum",
"<",
"?",
">",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an enum event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(Enum, Object...) | [
"Emit",
"an",
"enum",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"asynchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1009-L1011 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(String event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(String event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...) | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"asynchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1022-L1024 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(EventObject event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(EventObject event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"EventObject",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a event object with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(EventObject, Object...) | [
"Emit",
"a",
"event",
"object",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"asynchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1035-L1037 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"Enum",
"<",
"?",
">",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an enum event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(Enum, Object...) | [
"Emit",
"an",
"enum",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listener",
"to",
"be",
"called",
"synchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1079-L1081 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(String event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(String event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...) | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listener",
"to",
"be",
"called",
"synchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1092-L1094 | train |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(EventObject event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(EventObject event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"EventObject",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a event object with parameters and force all listeners to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(EventObject, Object...) | [
"Emit",
"a",
"event",
"object",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"synchronously",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1105-L1107 | train |
actframework/actframework | src/main/java/act/conf/ConfLoader.java | ConfLoader.common | public static String common() {
String common = SysProps.get(KEY_COMMON_CONF_TAG);
if (S.blank(common)) {
common = "common";
}
return common;
} | java | public static String common() {
String common = SysProps.get(KEY_COMMON_CONF_TAG);
if (S.blank(common)) {
common = "common";
}
return common;
} | [
"public",
"static",
"String",
"common",
"(",
")",
"{",
"String",
"common",
"=",
"SysProps",
".",
"get",
"(",
"KEY_COMMON_CONF_TAG",
")",
";",
"if",
"(",
"S",
".",
"blank",
"(",
"common",
")",
")",
"{",
"common",
"=",
"\"common\"",
";",
"}",
"return",
... | Return the "common" configuration set name. By default it is "common"
@return the "common" conf set name | [
"Return",
"the",
"common",
"configuration",
"set",
"name",
".",
"By",
"default",
"it",
"is",
"common"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/conf/ConfLoader.java#L87-L93 | train |
actframework/actframework | src/main/java/act/conf/ConfLoader.java | ConfLoader.confSetName | public static String confSetName() {
String profile = SysProps.get(AppConfigKey.PROFILE.key());
if (S.blank(profile)) {
profile = Act.mode().name().toLowerCase();
}
return profile;
} | java | public static String confSetName() {
String profile = SysProps.get(AppConfigKey.PROFILE.key());
if (S.blank(profile)) {
profile = Act.mode().name().toLowerCase();
}
return profile;
} | [
"public",
"static",
"String",
"confSetName",
"(",
")",
"{",
"String",
"profile",
"=",
"SysProps",
".",
"get",
"(",
"AppConfigKey",
".",
"PROFILE",
".",
"key",
"(",
")",
")",
";",
"if",
"(",
"S",
".",
"blank",
"(",
"profile",
")",
")",
"{",
"profile",... | Return the name of the current conf set
@return the conf set name | [
"Return",
"the",
"name",
"of",
"the",
"current",
"conf",
"set"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/conf/ConfLoader.java#L99-L105 | train |
actframework/actframework | src/main/java/act/conf/ConfLoader.java | ConfLoader.processConf | private static Map<String, Object> processConf(Map<String, ?> conf) {
Map<String, Object> m = new HashMap<String, Object>(conf.size());
for (String s : conf.keySet()) {
Object o = conf.get(s);
if (s.startsWith("act.")) s = s.substring(4);
m.put(s, o);
m.pu... | java | private static Map<String, Object> processConf(Map<String, ?> conf) {
Map<String, Object> m = new HashMap<String, Object>(conf.size());
for (String s : conf.keySet()) {
Object o = conf.get(s);
if (s.startsWith("act.")) s = s.substring(4);
m.put(s, o);
m.pu... | [
"private",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"processConf",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"conf",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"m",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
... | trim "act." from conf keys | [
"trim",
"act",
".",
"from",
"conf",
"keys"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/conf/ConfLoader.java#L226-L235 | train |
actframework/actframework | src/main/java/act/cli/CliContext.java | CliContext.curDir | public File curDir() {
File file = session().attribute(ATTR_PWD);
if (null == file) {
file = new File(System.getProperty("user.dir"));
session().attribute(ATTR_PWD, file);
}
return file;
} | java | public File curDir() {
File file = session().attribute(ATTR_PWD);
if (null == file) {
file = new File(System.getProperty("user.dir"));
session().attribute(ATTR_PWD, file);
}
return file;
} | [
"public",
"File",
"curDir",
"(",
")",
"{",
"File",
"file",
"=",
"session",
"(",
")",
".",
"attribute",
"(",
"ATTR_PWD",
")",
";",
"if",
"(",
"null",
"==",
"file",
")",
"{",
"file",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user... | Return the current working directory
@return the current working directory | [
"Return",
"the",
"current",
"working",
"directory"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/cli/CliContext.java#L307-L314 | train |
actframework/actframework | src/main/java/act/cli/ascii_table/impl/SimpleASCIITableImpl.java | SimpleASCIITableImpl.getRowLineBuf | private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) {
S.Buffer rowBuilder = S.buffer();
int colWidth;
for (int i = 0 ; i < colCount ; i ++) {
colWidth = colMaxLenList.get(i) + 3;
for (int j = 0; j < colWidth ; j ++) {
if (j==0) {
rowBuilder.append(... | java | private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) {
S.Buffer rowBuilder = S.buffer();
int colWidth;
for (int i = 0 ; i < colCount ; i ++) {
colWidth = colMaxLenList.get(i) + 3;
for (int j = 0; j < colWidth ; j ++) {
if (j==0) {
rowBuilder.append(... | [
"private",
"String",
"getRowLineBuf",
"(",
"int",
"colCount",
",",
"List",
"<",
"Integer",
">",
"colMaxLenList",
",",
"String",
"[",
"]",
"[",
"]",
"data",
")",
"{",
"S",
".",
"Buffer",
"rowBuilder",
"=",
"S",
".",
"buffer",
"(",
")",
";",
"int",
"co... | Each string item rendering requires the border and a space on both sides.
12 3 12 3 12 34
+----- +-------- +------+
abc venkat last
@param colCount
@param colMaxLenList
@param data
@return | [
"Each",
"string",
"item",
"rendering",
"requires",
"the",
"border",
"and",
"a",
"space",
"on",
"both",
"sides",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/cli/ascii_table/impl/SimpleASCIITableImpl.java#L338-L359 | train |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.toByteArray | public byte[] toByteArray() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(this);
return baos.toByteArray();
} catch (IOException e) {
throw E.ioException... | java | public byte[] toByteArray() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(this);
return baos.toByteArray();
} catch (IOException e) {
throw E.ioException... | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"baos",
")",
";",
"oos",
".",
"writ... | Serialize this `AppDescriptor` and output byte array
@return
serialize this `AppDescriptor` into byte array | [
"Serialize",
"this",
"AppDescriptor",
"and",
"output",
"byte",
"array"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L112-L121 | train |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.of | public static AppDescriptor of(String appName, Class<?> entryClass) {
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | java | public static AppDescriptor of(String appName, Class<?> entryClass) {
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | [
"public",
"static",
"AppDescriptor",
"of",
"(",
"String",
"appName",
",",
"Class",
"<",
"?",
">",
"entryClass",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"osgl.version.suppress-var-found-warning\"",
",",
"\"true\"",
")",
";",
"return",
"of",
"(",
"appName",... | Create an `AppDescriptor` with appName and entry class specified.
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param... | [
"Create",
"an",
"AppDescriptor",
"with",
"appName",
"and",
"entry",
"class",
"specified",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L196-L199 | train |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.of | public static AppDescriptor of(String appName, String packageName) {
String[] packages = packageName.split(S.COMMON_SEP);
return of(appName, packageName, Version.ofPackage(packages[0]));
} | java | public static AppDescriptor of(String appName, String packageName) {
String[] packages = packageName.split(S.COMMON_SEP);
return of(appName, packageName, Version.ofPackage(packages[0]));
} | [
"public",
"static",
"AppDescriptor",
"of",
"(",
"String",
"appName",
",",
"String",
"packageName",
")",
"{",
"String",
"[",
"]",
"packages",
"=",
"packageName",
".",
"split",
"(",
"S",
".",
"COMMON_SEP",
")",
";",
"return",
"of",
"(",
"appName",
",",
"pa... | Create an `AppDescriptor` with appName and package name specified
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param... | [
"Create",
"an",
"AppDescriptor",
"with",
"appName",
"and",
"package",
"name",
"specified"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L217-L220 | train |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.deserializeFrom | public static AppDescriptor deserializeFrom(byte[] bytes) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);
return (AppDescriptor) ois.readObject();
} catch (IOException e) {
throw E.i... | java | public static AppDescriptor deserializeFrom(byte[] bytes) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);
return (AppDescriptor) ois.readObject();
} catch (IOException e) {
throw E.i... | [
"public",
"static",
"AppDescriptor",
"deserializeFrom",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"try",
"{",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"ObjectInputStream",
"ois",
"=",
"new",
"ObjectInputStream",
... | Deserialize an `AppDescriptor` from byte array
@param bytes
the byte array
@return
an `AppDescriptor` instance | [
"Deserialize",
"an",
"AppDescriptor",
"from",
"byte",
"array"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L260-L270 | train |
actframework/actframework | src/main/java/act/internal/util/AppNameInferer.java | AppNameInferer.from | static String from(Class<?> entryClass) {
List<String> tokens = tokenOf(entryClass);
return fromTokens(tokens);
} | java | static String from(Class<?> entryClass) {
List<String> tokens = tokenOf(entryClass);
return fromTokens(tokens);
} | [
"static",
"String",
"from",
"(",
"Class",
"<",
"?",
">",
"entryClass",
")",
"{",
"List",
"<",
"String",
">",
"tokens",
"=",
"tokenOf",
"(",
"entryClass",
")",
";",
"return",
"fromTokens",
"(",
"tokens",
")",
";",
"}"
] | Infer app name from entry class
@param entryClass
the entry class
@return
app name inferred from the entry class | [
"Infer",
"app",
"name",
"from",
"entry",
"class"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppNameInferer.java#L42-L45 | train |
actframework/actframework | src/main/java/act/internal/util/AppNameInferer.java | AppNameInferer.fromPackageName | static String fromPackageName(String packageName) {
List<String> tokens = tokenOf(packageName);
return fromTokens(tokens);
} | java | static String fromPackageName(String packageName) {
List<String> tokens = tokenOf(packageName);
return fromTokens(tokens);
} | [
"static",
"String",
"fromPackageName",
"(",
"String",
"packageName",
")",
"{",
"List",
"<",
"String",
">",
"tokens",
"=",
"tokenOf",
"(",
"packageName",
")",
";",
"return",
"fromTokens",
"(",
"tokens",
")",
";",
"}"
] | Infer app name from scan package
@param packageName
the package name
@return
app name inferred from the package name | [
"Infer",
"app",
"name",
"from",
"scan",
"package"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppNameInferer.java#L55-L58 | train |
actframework/actframework | src/main/java/act/apidoc/javadoc/Utils.java | Utils.nextWord | public static String nextWord(String string) {
int index = 0;
while (index < string.length() && !Character.isWhitespace(string.charAt(index))) {
index++;
}
return string.substring(0, index);
} | java | public static String nextWord(String string) {
int index = 0;
while (index < string.length() && !Character.isWhitespace(string.charAt(index))) {
index++;
}
return string.substring(0, index);
} | [
"public",
"static",
"String",
"nextWord",
"(",
"String",
"string",
")",
"{",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"string",
".",
"length",
"(",
")",
"&&",
"!",
"Character",
".",
"isWhitespace",
"(",
"string",
".",
"charAt",
"(",
... | Return the next word of the string, in other words it stops when a space is encountered. | [
"Return",
"the",
"next",
"word",
"of",
"the",
"string",
"in",
"other",
"words",
"it",
"stops",
"when",
"a",
"space",
"is",
"encountered",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/apidoc/javadoc/Utils.java#L27-L33 | train |
actframework/actframework | src/main/java/act/data/ApacheMultipartParser.java | ApacheMultipartParser.getHeader | private final String getHeader(Map /* String, String */ headers, String name) {
return (String) headers.get(name.toLowerCase());
} | java | private final String getHeader(Map /* String, String */ headers, String name) {
return (String) headers.get(name.toLowerCase());
} | [
"private",
"final",
"String",
"getHeader",
"(",
"Map",
"/* String, String */",
"headers",
",",
"String",
"name",
")",
"{",
"return",
"(",
"String",
")",
"headers",
".",
"get",
"(",
"name",
".",
"toLowerCase",
"(",
")",
")",
";",
"}"
] | Returns the header with the specified name from the supplied map. The
header lookup is case-insensitive.
@param headers A <code>Map</code> containing the HTTP request headers.
@param name The name of the header to return.
@return The value of specified header, or a comma-separated list if there
were multiple header... | [
"Returns",
"the",
"header",
"with",
"the",
"specified",
"name",
"from",
"the",
"supplied",
"map",
".",
"The",
"header",
"lookup",
"is",
"case",
"-",
"insensitive",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L322-L324 | train |
actframework/actframework | src/main/java/me/tongfei/progressbar/ProgressBar.java | ProgressBar.stop | public ProgressBar stop() {
target.kill();
try {
thread.join();
target.consoleStream.print("\n");
target.consoleStream.flush();
}
catch (InterruptedException ex) { }
return this;
} | java | public ProgressBar stop() {
target.kill();
try {
thread.join();
target.consoleStream.print("\n");
target.consoleStream.flush();
}
catch (InterruptedException ex) { }
return this;
} | [
"public",
"ProgressBar",
"stop",
"(",
")",
"{",
"target",
".",
"kill",
"(",
")",
";",
"try",
"{",
"thread",
".",
"join",
"(",
")",
";",
"target",
".",
"consoleStream",
".",
"print",
"(",
"\"\\n\"",
")",
";",
"target",
".",
"consoleStream",
".",
"flus... | Stops this progress bar. | [
"Stops",
"this",
"progress",
"bar",
"."
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/me/tongfei/progressbar/ProgressBar.java#L124-L133 | train |
actframework/actframework | src/main/java/act/data/DataPropertyRepository.java | DataPropertyRepository.propertyListOf | public synchronized List<String> propertyListOf(Class<?> c) {
String cn = c.getName();
List<String> ls = repo.get(cn);
if (ls != null) {
return ls;
}
Set<Class<?>> circularReferenceDetector = new HashSet<>();
ls = propertyListOf(c, circularReferenceDetector, n... | java | public synchronized List<String> propertyListOf(Class<?> c) {
String cn = c.getName();
List<String> ls = repo.get(cn);
if (ls != null) {
return ls;
}
Set<Class<?>> circularReferenceDetector = new HashSet<>();
ls = propertyListOf(c, circularReferenceDetector, n... | [
"public",
"synchronized",
"List",
"<",
"String",
">",
"propertyListOf",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"String",
"cn",
"=",
"c",
".",
"getName",
"(",
")",
";",
"List",
"<",
"String",
">",
"ls",
"=",
"repo",
".",
"get",
"(",
"cn",
")"... | Returns the complete property list of a class
@param c the class
@return the property list of the class | [
"Returns",
"the",
"complete",
"property",
"list",
"of",
"a",
"class"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/DataPropertyRepository.java#L82-L92 | train |
actframework/actframework | src/main/java/act/util/ClassNode.java | ClassNode.parent | public ClassNode parent(String name) {
this.parent = infoBase.node(name);
this.parent.addChild(this);
for (ClassNode intf : parent.interfaces.values()) {
addInterface(intf);
}
return this;
} | java | public ClassNode parent(String name) {
this.parent = infoBase.node(name);
this.parent.addChild(this);
for (ClassNode intf : parent.interfaces.values()) {
addInterface(intf);
}
return this;
} | [
"public",
"ClassNode",
"parent",
"(",
"String",
"name",
")",
"{",
"this",
".",
"parent",
"=",
"infoBase",
".",
"node",
"(",
"name",
")",
";",
"this",
".",
"parent",
".",
"addChild",
"(",
"this",
")",
";",
"for",
"(",
"ClassNode",
"intf",
":",
"parent... | Specify the class represented by this `ClassNode` extends
a class with the name specified
@param name the name of the parent class
@return this `ClassNode` instance | [
"Specify",
"the",
"class",
"represented",
"by",
"this",
"ClassNode",
"extends",
"a",
"class",
"with",
"the",
"name",
"specified"
] | 55a8f8b45e71159a79ec6e157c02f71700f8cd54 | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/ClassNode.java#L109-L116 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.