Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Mathieu Saby 2018-11-18 11:17:03 +01:00
commit 13d20b6cb1
42 changed files with 809 additions and 147 deletions

Binary file not shown.

View File

@ -18,7 +18,7 @@ If you have cloned this repository to your computer, you can run OpenRefine with
* `./refine` on Mac OS and Linux * `./refine` on Mac OS and Linux
* `refine.bat` on Windows * `refine.bat` on Windows
This requires JDK 8 and Apache Ant. This requires JDK 8 and Apache Maven.
Documentation and Videos Documentation and Videos
------------------------- -------------------------

View File

@ -13,7 +13,7 @@
"alert-connection-name": "Vous devez spécifier un nom de connexion", "alert-connection-name": "Vous devez spécifier un nom de connexion",
"alert-initial-database": "Vous devez spécifier une base de données initiale", "alert-initial-database": "Vous devez spécifier une base de données initiale",
"alert-query": "Vous devez spécifier une requête valide", "alert-query": "Vous devez spécifier une requête valide",
"alert-invalid-query-keyword": "La requête ne peut pas contenir un mot clé dédié à la manipulation de données :", "alert-invalid-query-keyword": "La requête ne peut pas contenir ce mot clé destiné à manipuler la base de données :",
"alert-invalid-query-select": "La requête doit débuter par le mot-clé SELECT", "alert-invalid-query-select": "La requête doit débuter par le mot-clé SELECT",
"form-validation-failure": "Le nouveau formulaire de connexion est invalide!", "form-validation-failure": "Le nouveau formulaire de connexion est invalide!",
"alert-connection-edit": "La connexion a été éditée avec succès", "alert-connection-edit": "La connexion a été éditée avec succès",

View File

@ -0,0 +1,51 @@
{
"database-import": {
"title": "Databasetjenere",
"preparing": "Forbereder resultat …",
"checking": "Validerer spørring …",
"creating": "Oppretter prosjekt …"
},
"database-source": {
"alert-host": "Du må angi en databasevert",
"alert-port": "Du må angi en databaseport",
"alert-user": "Du må angi en databasebruker",
"alert-password": "Du må angi et databasepassord",
"alert-connection-name": "Du må angi et tilkoblingsnavn",
"alert-initial-database": "Du må angi en initiell database",
"alert-query": "Du må angi en gyldig spørring",
"alert-invalid-query-select": "Spørringen må starte med nøkkelordet SELECT",
"alert-connection-edit": "Tilkoblingen ble redigert",
"connectionNameLabel": "Navn:",
"databaseTypeLabel": "Type:",
"databaseHostLabel": "Vert:",
"databasePortLabel": "Port:",
"databaseUserLabel": "Bruker:",
"databasePasswordLabel": "Passord:",
"databaseNameLabel": "Database:",
"databaseSchemaLabel": "Skjema:",
"databaseTestButton": "Test",
"databaseSaveButton": "Lagre",
"databaseConnectButton": "Koble til",
"newConnectionButtonDiv": "Ny tilkobling",
"savedConnectionSpan": "Lagrede tilkoblinger"
},
"database-parsing": {
"start-over": "« Begynn på nytt",
"conf-pars": "Konfigurer tolkningsinnstillinger",
"proj-name": "Prosjektnavn",
"create-proj": "Opprett prosjekt »",
"updating-preview": "Oppdaterer forhåndsvisning …",
"option": "Innstillinger",
"preview-button": "Oppdater forhåndsvisning",
"ignore-first": "Ignorer første",
"ignore": "linje(r) i begynnelsen av fila",
"parse-next": "Tolk neste",
"parse": "linje(r) som kolonneoverskrifter",
"discard-next": "Forkast de første",
"discard": "raden(e) med data",
"limit-next": "Last maksimalt",
"limit": "rad(er) med data",
"store-row": "Lagre blanke rader",
"store-cell": "Lagre blanke celler som null"
}
}

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>database</artifactId> <artifactId>database</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - Database extension</name> <name>OpenRefine - Database extension</name>
<description>Connections to SQL databases for import and export</description> <description>Connections to SQL databases for import and export</description>

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>gdata</artifactId> <artifactId>gdata</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - Gdata extension</name> <name>OpenRefine - Gdata extension</name>
<description>Connects with Google services for data import and export</description> <description>Connects with Google services for data import and export</description>

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>pc-axis</artifactId> <artifactId>pc-axis</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - PC-axis extension</name> <name>OpenRefine - PC-axis extension</name>
<description>OpenRefine integration of PC-axis</description> <description>OpenRefine integration of PC-axis</description>

View File

@ -36,8 +36,10 @@ function init() {
*/ */
var ExporterRegistry = Packages.com.google.refine.exporters.ExporterRegistry; var ExporterRegistry = Packages.com.google.refine.exporters.ExporterRegistry;
var QSExporter = Packages.org.openrefine.wikidata.exporters.QuickStatementsExporter; var QSExporter = Packages.org.openrefine.wikidata.exporters.QuickStatementsExporter;
var SchemaExporter = Packages.org.openrefine.wikidata.exporters.SchemaExporter;
ExporterRegistry.registerExporter("quickstatements", new QSExporter()); ExporterRegistry.registerExporter("quickstatements", new QSExporter());
ExporterRegistry.registerExporter("wikibase-schema", new SchemaExporter());
/* /*
* Commands * Commands
@ -62,6 +64,7 @@ function init() {
"scripts/dialogs/schema-alignment-dialog.js", "scripts/dialogs/schema-alignment-dialog.js",
"scripts/dialogs/manage-account-dialog.js", "scripts/dialogs/manage-account-dialog.js",
"scripts/dialogs/perform-edits-dialog.js", "scripts/dialogs/perform-edits-dialog.js",
"scripts/dialogs/import-schema-dialog.js",
"scripts/jquery.uls.data.js", "scripts/jquery.uls.data.js",
]); ]);
@ -71,6 +74,7 @@ function init() {
[ [
"styles/dialogs/schema-alignment-dialog.css", "styles/dialogs/schema-alignment-dialog.css",
"styles/dialogs/manage-account-dialog.less", "styles/dialogs/manage-account-dialog.less",
"styles/dialogs/import-schema-dialog.less",
"styles/dialogs/perform-edits.less", "styles/dialogs/perform-edits.less",
]); ]);

View File

@ -2,9 +2,11 @@
"wikidata-extension": { "wikidata-extension": {
"menu-label": "Wikidata", "menu-label": "Wikidata",
"edit-wikidata-schema": "Edit Wikidata schema", "edit-wikidata-schema": "Edit Wikidata schema",
"import-wikidata-schema": "Import schema",
"manage-wikidata-account": "Manage Wikidata account", "manage-wikidata-account": "Manage Wikidata account",
"perform-edits-on-wikidata": "Upload edits to Wikidata", "perform-edits-on-wikidata": "Upload edits to Wikidata",
"export-to-qs": "Export to QuickStatements", "export-to-qs": "Export to QuickStatements",
"export-schema": "Export schema",
"quickstatements-export-name": "QuickStatements" "quickstatements-export-name": "QuickStatements"
}, },
"wikidata-schema": { "wikidata-schema": {
@ -79,6 +81,13 @@
"cancel": "Cancel", "cancel": "Cancel",
"analyzing-edits": "Analyzing your edits..." "analyzing-edits": "Analyzing your edits..."
}, },
"import-wikibase-schema": {
"dialog-header": "Import Wikidata schema",
"file-label": "From JSON file: ",
"schema-label": "Or from JSON text:",
"invalid-schema": "Invalid Wikibase schema.",
"import": "Import"
},
"warnings-messages": { "warnings-messages": {
"new-item-created": { "new-item-created": {
"title": "This edit batch will create new Wikidata items.", "title": "This edit batch will create new Wikidata items.",
@ -169,14 +178,6 @@
"title": "No language provided for monolingual text.", "title": "No language provided for monolingual text.",
"body": "Some label, description, alias or monolingual text value have been skipped because no language was provided. Example value: <span class=\"wb-issue-preformat\">{example_text}</span>." "body": "Some label, description, alias or monolingual text value have been skipped because no language was provided. Example value: <span class=\"wb-issue-preformat\">{example_text}</span>."
}, },
"leading-whitespace": {
"title": "Leading whitespace in strings.",
"body": "Strings such as <span class=\"wb-issue-preformat\">{example_string}</span> have leading whitespace."
},
"trailing-whitespace": {
"title": "Trailing whitespace in strings.",
"body": "Strings such as <span class=\"wb-issue-preformat\">{example_string}</span> have trailing whitespace."
},
"duplicate-whitespace": { "duplicate-whitespace": {
"title": "Duplicate whitespace in strings.", "title": "Duplicate whitespace in strings.",
"body": "Strings such as <span class=\"wb-issue-preformat\">{example_string}</span> contain duplicate whitespace." "body": "Strings such as <span class=\"wb-issue-preformat\">{example_string}</span> contain duplicate whitespace."

View File

@ -168,14 +168,6 @@
"title": "Pas de langue fournie pour des textes monolingues.", "title": "Pas de langue fournie pour des textes monolingues.",
"body": "Des libellés, descriptions, alias ou textes monolingues ont été ignorés car aucune langue n'a été fournie. Exemple: <span class=\"wb-issue-preformat\">{example_text}</span>." "body": "Des libellés, descriptions, alias ou textes monolingues ont été ignorés car aucune langue n'a été fournie. Exemple: <span class=\"wb-issue-preformat\">{example_text}</span>."
}, },
"leading-whitespace": {
"title": "Espaces au début de chaînes de caractères.",
"body": "Des chaînes telles que <span class=\"wb-issue-preformat\">{example_string}</span> ont des espaces au début."
},
"trailing-whitespace": {
"title": "Espaces à la fin de chaînes de caractères.",
"body": "Des chaînes telles que <span class=\"wb-issue-preformat\">{example_string}</span> ont des espaces à la fin."
},
"duplicate-whitespace": { "duplicate-whitespace": {
"title": "Espaces dédoublées dans des chaînes de caractères.", "title": "Espaces dédoublées dans des chaînes de caractères.",
"body": "Des chaînes telles que <span class=\"wb-issue-preformat\">{example_string}</span> contiennent des espaces dédoublées." "body": "Des chaînes telles que <span class=\"wb-issue-preformat\">{example_string}</span> contiennent des espaces dédoublées."

View File

@ -5,7 +5,9 @@
"manage-wikidata-account": "Wikidataアカウントの管理", "manage-wikidata-account": "Wikidataアカウントの管理",
"perform-edits-on-wikidata": "Wikidataへアップロード", "perform-edits-on-wikidata": "Wikidataへアップロード",
"export-to-qs": "クイック・ステートメントへ出力", "export-to-qs": "クイック・ステートメントへ出力",
"quickstatements-export-name": "クイック・ステートメント" "quickstatements-export-name": "クイック・ステートメント",
"import-wikidata-schema": "スキーマのインポート",
"export-schema": "スキーマのエクスポート"
}, },
"wikidata-schema": { "wikidata-schema": {
"dialog-header": "Wikidataにアライン", "dialog-header": "Wikidataにアライン",
@ -180,14 +182,6 @@
"title": "言語指定がありません.", "title": "言語指定がありません.",
"body": "言語指定がないので、ラベル・記述・別名・単一言語テキストが無視されました。例えば: <span class=\"wb-issue-preformat\">{example_text}</span>." "body": "言語指定がないので、ラベル・記述・別名・単一言語テキストが無視されました。例えば: <span class=\"wb-issue-preformat\">{example_text}</span>."
}, },
"leading-whitespace": {
"title": "文頭に空白文字があります.",
"body": "<span class=\"wb-issue-preformat\">{example_string}</span>の文頭に空白文字があります."
},
"trailing-whitespace": {
"title": "文末に空白文字があります.",
"body": "<span class=\"wb-issue-preformat\">{example_string}</span>の文末に空白文字があります."
},
"duplicate-whitespace": { "duplicate-whitespace": {
"title": "二重の空白文字があります.", "title": "二重の空白文字があります.",
"body": "<span class=\"wb-issue-preformat\">{example_string}</span>には二重の空白文字があります." "body": "<span class=\"wb-issue-preformat\">{example_string}</span>には二重の空白文字があります."
@ -252,5 +246,12 @@
"title": "アイテムに使われる{property_entity}", "title": "アイテムに使われる{property_entity}",
"body": "{example_entity}のようなアイテムに{property_entity}を使うことは無効です." "body": "{example_entity}のようなアイテムに{property_entity}を使うことは無効です."
} }
},
"import-wikibase-schema": {
"dialog-header": "Wikidataスキーマのインポート",
"file-label": "JSONファイル: ",
"schema-label": "あるいは、JSONテキスト:",
"invalid-schema": "無効のWikidataスキーマです。",
"import": "インポート"
} }
} }

View File

@ -0,0 +1,233 @@
{
"wikidata-extension": {
"menu-label": "Wikidata",
"edit-wikidata-schema": "Rediger Wikidata-skjema",
"import-wikidata-schema": "Importer skjema",
"manage-wikidata-account": "Behandle Wikidata-konto",
"perform-edits-on-wikidata": "Last opp redigeringer til Wikidata",
"export-to-qs": "Eksporter til QuickStatements",
"export-schema": "Eksporter skjema",
"quickstatements-export-name": "QuickStatements"
},
"wikidata-schema": {
"dialog-header": "Innrett til Wikidata",
"dialog-explanation": "Wikidata-skjemaet nedenfor spesifiserer hvordan dine tabulære data vil transformeres til Wikidata-redigeringer. Du kan dra og slippe kolonnenavnene nedenfor til de fleste inndataboksene: for hver rad vil redigeringer genereres med verdiene i disse kolonnene.",
"preview-explanation": "Denne fanen viser de første (av {nb_edits}) redigeringene som vil gjøres når du laster opp endringene til Wikidat. Du kan bruke fasetter for å ettergå redigeringene til spesifikke elementer.",
"schema-tab-header": "Skjema",
"warnings-tab-header": "Saker",
"edits-preview-tab-header": "Forhåndsvisning",
"statements-header": "Påstander",
"terms-header": "Termer",
"empty-statements": "ingen påstander lagt til",
"empty-terms": "ingen etiketter, beskrivelser eller aliaser lagt til",
"add-item-button": "legg til element",
"add-term": "legg til term",
"remove": "fjern",
"add-statement": "legg til påstand",
"add-value": "legg til verdi",
"add-qualifier": "legg til kvalifikator",
"add-reference": "legg til referanse",
"add-reference-snak": "legg til",
"property-placeholder": "egenskap",
"nb-references": "&nbsp;referanser",
"remove-column": "fjern kolonne",
"label": "Etikett",
"description": "Beskrivelse",
"alias": "Alias",
"item-or-reconciled-column": "skriv inn element eller dra avstemt kolonne hit",
"amount": "antall",
"unit": "enhet",
"full-url": "full URL inkludert protokoll",
"tabular-data-with-prefix": "filnavn som begynner med «Data:»",
"commons-media": "filnavn",
"math-expression": "matematisk uttrykk",
"geoshape-with-prefix": "filnavn som begynner med «Data:»",
"datatype-not-supported-yet": "Denne datatypen støttes dessverre ikke ennå.",
"invalid-schema-warning-issues": "Skjemaet ditt er ufullstendig, fiks det for å se problemene.",
"invalid-schema-warning-preview": "Skjemaet ditt er ufullstendig, fiks det for å se forhåndsvisningen.",
"discard-button": "Forkast endringer",
"save-button": "Lagre skjema",
"close-button": "Lukk",
"unsaved-changes-alt": "Du har gjort ulagrede endringer i Wikidata-skjemaet ditt.",
"save-schema-alt": "Lagre skjemaet i OpenRefine. Endringene blir ikke lastet opp til Wikidata ennå.",
"discard-schema-changes-alt": "Forkast endringene som er gjort i skjemaet.",
"incomplete-schema-could-not-be-saved": "Skjemaet ditt er ufullstendig, så det kan ikke lagres ennå.",
"unsaved-warning": "Du har gjort ulagrede endringer i Wikidata-skjemaet ditt. Lukke likevel?"
},
"wikidata-preview": {
"new-id": "nytt element"
},
"wikidata-account": {
"dialog-header": "Wikidata-konto",
"explain-log-in": "Hvis du logger inn på <a href=\"https://www.wikidata.org/\" target=\"_blank\">Wikidata</a> kan du laste opp redigeringer direkte fra OpenRefine.",
"username-label": "Brukernavn:",
"username-placeholder": "Skriv inn brukernavnet ditt",
"password-label": "Passord:",
"password-placeholder": "Skriv inn passordet ditt",
"remember-credentials-label": "Husk meg (lagres ukryptert i OpenRefines innstillinger)",
"close": "Lukk",
"log-in": "Logg inn",
"logged-in-as": "Du er logget inn som:",
"log-out": "Logg ut",
"connecting-to-wikidata": "Kobler til Wikidata …"
},
"perform-wikidata-edits": {
"dialog-header": "Last opp redigeringer på Wikidata",
"review-your-edits": "Du er i ferd med å laste opp {nb_edits} redigeringer på Wikidata. Sjekk dem nøye. Store redigeringspartier bør gå gjennom <a href=\"https://www.wikidata.org/wiki/Wikidata:Requests_for_permissions/Bot\" target=\"_blank\">botgodkjenning</a> først.",
"logged-in-as": "Du er logget inn som",
"edit-summary-label": "Redigeringsforklaring:",
"edit-summary-placeholder": "noen ord som beskriver redigeringene dine",
"perform-edits": "Last opp redigeringer",
"cancel": "Avbryt",
"analyzing-edits": "Analyserer redigeringene dine …"
},
"import-wikibase-schema": {
"dialog-header": "Importer Wikidata-skjema",
"file-label": "Fra JSON-fil: ",
"schema-label": "Eller fra JSON-tekst:",
"invalid-schema": "Ugyldig Wikibase-skjema.",
"import": "Importer"
},
"warnings-messages": {
"new-item-created": {
"title": "Dette redigeringspartiet vil opprette nye Wikidata-elementer.",
"body": "Sjekk at disse elementene ikke finnes ennå og <a href=\"https://www.wikidata.org/wiki/Wikidata:Notability\" target=\"_blank\">passer for inkludering på Wikidata</a>."
},
"new-item-without-labels-or-aliases": {
"title": "Nye elementer opprettet uten etikett eller alias.",
"body": "Du bør angi minst én etikett for nye elementer som {example_entity}, så andre kan forstå hva elementet handler om."
},
"new-item-without-descriptions": {
"title": "Nye elementer opprettet uten beskrivelse.",
"body": "Å legge til beskrivelser til nye elementer som {example_entity} gjør det enklere å skille elementer fra hverandre om de har samme etikett."
},
"new-item-with-deleted-statements": {
"title": "Sletter påstander i nye elementer.",
"body": "Det er trolig noe galt med skjemaet eller prosjektet ditt."
},
"new-item-without-P31-or-P279": {
"title": "Nye elementer opprettet uten type.",
"body": "Du bør angi påstanden «forekomst av» (P31) eller «underklasse av» (P279) for hvert element du oppretter, som {example_entity}."
},
"add-statements-with-invalid-format": {
"title": "{property_entity} påstander med ugyldig format.",
"body": "Verdiene for denne egenskapen forventes å matche det regulære uttrykket <span class=\"wb-issue-preformat\">{regex}</span>, noe som ikke er tilfelle for <span class=\"wb-issue-preformat\">{example_value}</span> lagt til på {example_item_entity}."
},
"remove-statements-with-invalid-format": {
"title": "Fjernet påstander med ugyldig format.",
"body": "Hvis disse påstandene for tiden finnes på Wikidata vil dette løse brudd på begrensninger."
},
"missing-inverse-statements": {
"title": "Inverse påstander mangler for {added_property_entity}.",
"body": "{added_property_entity}-påstander som den fra {source_entity} til {target_entity} bør legges til inverst med {inverse_property_entity}: i dette tilfellet, {target_entity} {inverse_property_entity} {source_entity}."
},
"self-referential-statements": {
"title": "Selv-refererende påstander.",
"body": "Det er ikke forbudt, men selv-refererende påstander er generelt sett mistenkelige. Du har noen slike i {example_entity}."
},
"unsourced-statements": {
"title": "Påstander uten referanser.",
"body": "De fleste påstander bør ha referanser. Du kan enkelt legge dem til i skjemaet."
},
"property-found-in-mainsnak": {
"title": "{property_entity} brukt som påstand.",
"body": "Du bruker {property_entity} som hovedpåstand, men den er ikke designet for det."
},
"property-found-in-qualifier": {
"title": "{property_entity} brukt som kvalifikator.",
"body": "Du bruker {property_entity} som kvalifikator, men den er ikke designet for det."
},
"property-found-in-reference": {
"title": "{property_entity} brukt som referanse.",
"body": "Du bruker {property_entity} i en referanse, men den er ikke designet for det."
},
"missing-mandatory-qualifiers": {
"title": "{statement_property_entity} mangler en {missing_property_entity}-kvalifikator.",
"body": "Påstander som bruker {statement_property_entity}, som den i {example_item_entity}, mangler en obligatorisk {missing_property_entity}-kvalifikator."
},
"disallowed-qualifiers": {
"title": "Kvalifikatoren {disallowed_property_entity} er ikke kompatibel med {statement_property_entity}.",
"body": "Påstander som bruker {statement_property_entity}, som den i {example_item_entity}, bør ikke ha kvalifikatoren {disallowed_property_entity}, da de ikke er kompatible."
},
"single-valued-property-added-more-than-once": {
"title": "{property_entity} lagt til mer enn én gang i samme element.",
"body": "Denne egenskapet forventes brukt maks én gang per element, men har blitt lagt til flere ganger i samme element, for eksempel i {example_entity}."
},
"identical-values-for-distinct-valued-property": {
"title": "Identiske verdier for {property_entity}",
"body": "Denne egenskapen bør ha distinkte verdier, men samme verdi ble funnet i for eksempel {item1_entity} og {item2_entity}."
},
"no-edit-generated": {
"title": "Ingen redigering ble generert.",
"body": "Det kan være noe galt med skjemaet ditt."
},
"no-issue-detected": {
"title": "Ingen problemer ble oppdaget i redigeringene dine.",
"body": "Merk at OpenRefine ikke kan oppdage alle slags problemer Wikidata-redigeringer kan ha."
},
"ignored-qualifiers": {
"title": "Noen kvalifikatorer ble ignorert.",
"body": "Kvalifikatorverdier kunne ikke tolkes, så de blir ikke lagt til i de samsvarende påstandene."
},
"ignored-references": {
"title": "Noen referanser ble ignorert.",
"body": "Ingen av påstandene deres kunne tolkes, så ingen referanser ble lagt til."
},
"monolingual-text-without-language": {
"title": "Intet språk angitt for enspråklig tekst.",
"body": "Noen etiketter, beskrivelser, aliaser eller enspråklige tekstverdier har blitt hoppet over fordi språk ikke var angitt. Eksempelverdi: <span class=\"wb-issue-preformat\">{example_text}</span>."
},
"duplicate-whitespace": {
"title": "Dobbelt mellomrom i strenger.",
"body": "Strenger som <span class=\"wb-issue-preformat\">{example_string}</span> inneholder dobbelt mellomrom."
},
"non-printable-characters": {
"title": "Utrykkbare tegn i strenger.",
"body": "Strenger som <span class=\"wb-issue-preformat\">{example_string}</span> inneholder utrykkbare tegn."
},
"invalid-identifier-space": {
"title": "Ugyldig identifikatorrom for avstemte celler.",
"body": "Noen avstemnte celler, som <span class=\"wb-issue-preformat\">{example_cell}</span> ble ignorert fordi de ikke er avstemt mot Wikidata."
},
"ignored-language": {
"title": "Ugyldige språkidentifikatorer.",
"body": "Noen språkidentifikatorer er ugyldige, som <span class=\"wb-issue-preformat\">{example_value}</span>. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Languages\" target=\"_blank\">de tillatte verdiene</a>."
},
"ignored-date": {
"title": "Ugyldige datoformater.",
"body": "Noen datoer er galt formatert, som <span class=\"wb-issue-preformat\">{example_value}</span>. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Dates\" target=\"_blank\">de tillatte formatene</a>."
},
"ignored-amount": {
"title": "Ugyldige tallformater.",
"body": "Noen tall er galt formatert, som <span class=\"wb-issue-preformat\">{example_value</span>. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Quantities\" target=\"_blank\">de tillatte formatene</a>."
},
"ignored-coordinates": {
"title": "Ugyldige geografiske koordinater.",
"body": "Noen koordinater er galt formatert, som <span class=\"wb-issue-preformat\">{example_value}</span>. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Globe_coordinates\" target=\"_blank\">de tillatte formatene</a>."
},
"forbidden-value": {
"title": "Ugyldige verdier for {property_entity}",
"body": "Elementer som {example_value_entity} lagt til i {example_subject_entity} er ikke tillatte som verdier for {property_entity}."
},
"bounds-disallowed": {
"title": "Kvantitetsgrenser gitt for {property_entity}",
"body": "Verdier forventes å ikke ha usikkerhetsgrenser, men <span class=\"wb-issue-preformat\">{example_value}</span> lagt til i {example_item_entity} har det. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Quantities\" target=\"_blank\">manualen</a> for å lære hvordan man fikser formatet."
},
"values-should-be-integers": {
"title": "Verdier som ikke er heltall for {property_entity}",
"body": "Verdier forventes å være heltall, men <span class=\"wb-issue-preformat\">{example_value}</span> lagt til i {example_item_entity} har desimaler. Se <a href=\"https://www.wikidata.org/wiki/Wikidata:Tools/OpenRefine/Editing/Schema_alignment#Quantities\" target=\"_blank\">manualen</a> for å finne ut hvordan man fikser formatet."
},
"invalid-unit": {
"title": "{property_entity} med ugyldige enheter",
"body": "Enheter som {unit_entity} brukt i {example_item_entity} er ugyldige for {property_entity}."
},
"no-unit-provided": {
"title": "Enhet mangler for {property_entity}",
"body": "Verdier som <span class=\"wb-issue-preformat\">{example_value}</span> i {example_item_entity} forventes å ha enheter."
},
"invalid-entity-type": {
"title": "{property_entity} brukt i elementer",
"body": "Bruken av {property_entity} i elementer som {example_entity} er ugyldig."
}
}
}

View File

@ -0,0 +1,13 @@
<div class="dialog-frame" style="width: 800px;">
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<label for="schema-file" bind="fileLabel"></label><input type="file" name="schema-file" bind="fileInput" /><br />
<label for="schema" bind="schemaLabel"></label><br />
<textarea name="schema" class="wikibase-schema-textarea" bind="schemaTextarea"></textarea><br />
<div class="wikibase-invalid-schema" bind="invalidSchema"></div>
<div class="wikibase-login-buttons">
<button class="button cancel-button" bind="cancelButton"></button>
<button class="button button-primary" bind="importButton"></button>
</div>
</div>
</div>

View File

@ -0,0 +1,64 @@
var ImportSchemaDialog = {};
ImportSchemaDialog.launch = function() {
var self = this;
var frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/import-schema-dialog.html"));
var elmts = this._elmts = DOM.bind(frame);
this._elmts.dialogHeader.text($.i18n._('import-wikibase-schema')["dialog-header"]);
this._elmts.fileLabel.html($.i18n._('import-wikibase-schema')["file-label"]);
this._elmts.schemaLabel.text($.i18n._('import-wikibase-schema')["schema-label"]);
this._elmts.cancelButton.text($.i18n._('core-project')["cancel"]);
this._elmts.importButton.text($.i18n._('import-wikibase-schema')["import"]);
this._level = DialogSystem.showDialog(frame);
var dismiss = function() {
DialogSystem.dismissUntil(self._level - 1);
};
frame.find('.cancel-button').click(function() {
dismiss();
});
elmts.fileInput.on("change", function(evt) {
var file = evt.target.files[0];
var freader = new FileReader();
freader.onload = function(evt) {
elmts.schemaTextarea.val(evt.target.result);
elmts.schemaTextarea.hide();
elmts.schemaLabel.hide();
}
freader.readAsText(file);
});
elmts.importButton.click(function() {
var schema = null;
try {
schema = JSON.parse(elmts.schemaTextarea.val());
} catch(e) {
elmts.invalidSchema.text($.i18n._('import-wikibase-schema')["invalid-schema"]);
return;
}
Refine.postProcess(
"wikidata",
"save-wikibase-schema",
{},
{ schema: JSON.stringify(schema) },
{},
{
onDone: function() {
theProject.overlayModels.wikibaseSchema = schema;
SchemaAlignmentDialog._discardChanges();
dismiss();
},
onError: function(e) {
elmts.invalidSchema.text($.i18n._('import-wikibase-schema')["invalid-schema"]);
},
}
);
});
};

View File

@ -198,6 +198,10 @@ SchemaAlignmentDialog.switchTab = function(targetTab) {
// Resize the inside of the schema panel // Resize the inside of the schema panel
var headerHeight = this._schemaElmts.schemaHeader.outerHeight(); var headerHeight = this._schemaElmts.schemaHeader.outerHeight();
this._schemaElmts.canvas.height(panelHeight - headerHeight - 10); this._schemaElmts.canvas.height(panelHeight - headerHeight - 10);
if (targetTab === "#view-panel") {
ui.dataTableView.render();
}
} }
SchemaAlignmentDialog.isSetUp = function() { SchemaAlignmentDialog.isSetUp = function() {

View File

@ -19,19 +19,37 @@ $.i18n.setDictionary(dictionary);
ExporterManager.MenuItems.push({}); ExporterManager.MenuItems.push({});
ExporterManager.MenuItems.push( ExporterManager.MenuItems.push(
{ {
"id" : "exportQuickStatements", id:"performWikibaseEdits",
"label": $.i18n._('wikidata-extension')["quickstatements-export-name"], label: $.i18n._('wikidata-extension')["perform-edits-on-wikidata"],
"click": function() { WikibaseSchemaExporterMenuBar.checkSchemaAndExport(); } click: function() { PerformEditsDialog.checkAndLaunch(); }
});
ExporterManager.MenuItems.push(
{
id:"exportQuickStatements",
label: $.i18n._('wikidata-extension')["export-to-qs"],
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); }
});
ExporterManager.MenuItems.push(
{
id:"exportWikibaseSchema",
label: $.i18n._('wikidata-extension')["export-schema"],
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
} }
); );
WikibaseExporterMenuBar = {}; WikibaseExporterMenuBar = {};
WikibaseExporterMenuBar.exportTo = function(format) { WikibaseExporterMenuBar.exportTo = function(format) {
var targetUrl = null;
if (format ==="quickstatements") {
targetUrl = "statements.txt";
} else {
targetUrl = "schema.json";
}
var form = document.createElement("form"); var form = document.createElement("form");
$(form).css("display", "none") $(form).css("display", "none")
.attr("method", "post") .attr("method", "post")
.attr("action", "command/core/export-rows/statements.txt") .attr("action", "command/core/export-rows/"+targetUrl)
.attr("target", "gridworks-export"); .attr("target", "gridworks-export");
$('<input />') $('<input />')
.attr("name", "engine") .attr("name", "engine")
@ -54,9 +72,9 @@ WikibaseExporterMenuBar.exportTo = function(format) {
document.body.removeChild(form); document.body.removeChild(form);
}; };
WikibaseExporterMenuBar.checkSchemaAndExport = function() { WikibaseExporterMenuBar.checkSchemaAndExport = function(format) {
var onSaved = function(callback) { var onSaved = function(callback) {
WikibaseExporterMenuBar.exportTo("quickstatements"); WikibaseExporterMenuBar.exportTo(format);
}; };
if (!SchemaAlignmentDialog.isSetUp()) { if (!SchemaAlignmentDialog.isSetUp()) {
SchemaAlignmentDialog.launch(null); SchemaAlignmentDialog.launch(null);
@ -85,6 +103,18 @@ $(function(){
label: $.i18n._('wikidata-extension')["manage-wikidata-account"], label: $.i18n._('wikidata-extension')["manage-wikidata-account"],
click: function() { ManageAccountDialog.checkAndLaunch(); } click: function() { ManageAccountDialog.checkAndLaunch(); }
}, },
{},
{
id: "wikidata/import-schema",
label: $.i18n._('wikidata-extension')["import-wikidata-schema"],
click: function() { ImportSchemaDialog.launch(); }
},
{
id:"wikidata/export-schema",
label: $.i18n._('wikidata-extension')["export-schema"],
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
},
{},
{ {
id:"wikidata/perform-edits", id:"wikidata/perform-edits",
label: $.i18n._('wikidata-extension')["perform-edits-on-wikidata"], label: $.i18n._('wikidata-extension')["perform-edits-on-wikidata"],
@ -93,7 +123,7 @@ $(function(){
{ {
id:"wikidata/export-qs", id:"wikidata/export-qs",
label: $.i18n._('wikidata-extension')["export-to-qs"], label: $.i18n._('wikidata-extension')["export-to-qs"],
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport(); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); }
}, },
] ]

View File

@ -130,7 +130,8 @@ EditRenderer._renderStatement = function(json, container) {
var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right); var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right);
if (json.qualifiers) { if (json.qualifiers) {
for (var pid in json.qualifiers) { for (var pid_id in json['qualifiers-order']) {
var pid = json['qualifiers-order'][pid_id];
if (json.qualifiers.hasOwnProperty(pid)) { if (json.qualifiers.hasOwnProperty(pid)) {
var qualifiers = json.qualifiers[pid]; var qualifiers = json.qualifiers[pid];
for (var i = 0; i != qualifiers.length; i++) { for (var i = 0; i != qualifiers.length; i++) {

View File

@ -0,0 +1,10 @@
@import-less url("../theme.less");
.wikibase-invalid-schema {
color: red;
}
.wikibase-schema-textarea {
width: 100%;
height: 100px;

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>wikidata</artifactId> <artifactId>wikidata</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - Wikidata extension</name> <name>OpenRefine - Wikidata extension</name>
<description>Schema alignment and data upload for Wikidata</description> <description>Schema alignment and data upload for Wikidata</description>

View File

@ -24,6 +24,8 @@
package org.openrefine.wikidata.commands; package org.openrefine.wikidata.commands;
import static org.openrefine.wikidata.commands.CommandUtilities.respondError;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.List; import java.util.List;
@ -36,7 +38,6 @@ import javax.servlet.http.HttpServletResponse;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONWriter; import org.json.JSONWriter;
import org.openrefine.wikidata.qa.EditInspector; import org.openrefine.wikidata.qa.EditInspector;
import org.openrefine.wikidata.qa.QAWarning; import org.openrefine.wikidata.qa.QAWarning;
@ -45,10 +46,7 @@ import org.openrefine.wikidata.schema.WikibaseSchema;
import org.openrefine.wikidata.updates.ItemUpdate; import org.openrefine.wikidata.updates.ItemUpdate;
import org.openrefine.wikidata.updates.scheduler.WikibaseAPIUpdateScheduler; import org.openrefine.wikidata.updates.scheduler.WikibaseAPIUpdateScheduler;
import static org.openrefine.wikidata.commands.CommandUtilities.respondError;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.refine.browsing.Engine; import com.google.refine.browsing.Engine;
import com.google.refine.commands.Command; import com.google.refine.commands.Command;
import com.google.refine.model.Project; import com.google.refine.model.Project;

View File

@ -0,0 +1,31 @@
package org.openrefine.wikidata.exporters;
import java.io.IOException;
import java.io.Writer;
import java.util.Properties;
import org.json.JSONWriter;
import org.openrefine.wikidata.schema.WikibaseSchema;
import com.google.refine.browsing.Engine;
import com.google.refine.exporters.WriterExporter;
import com.google.refine.model.Project;
public class SchemaExporter implements WriterExporter {
@Override
public String getContentType() {
return "application/octet-stream";
}
@Override
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
WikibaseSchema schema = (WikibaseSchema) project.overlayModels.get("wikibaseSchema");
if (schema == null) {
schema = new WikibaseSchema();
}
JSONWriter jsonWriter = new JSONWriter(writer);
schema.write(jsonWriter, new Properties());
}
}

View File

@ -43,15 +43,11 @@ public class WhitespaceScrutinizer extends ValueScrutinizer {
private Map<String, Pattern> _issuesMap; private Map<String, Pattern> _issuesMap;
public static final String leadingWhitespaceType = "leading-whitespace";
public static final String trailingWhitespaceType = "trailing-whitespace";
public static final String duplicateWhitespaceType = "duplicate-whitespace"; public static final String duplicateWhitespaceType = "duplicate-whitespace";
public static final String nonPrintableCharsType = "non-printable-characters"; public static final String nonPrintableCharsType = "non-printable-characters";
public WhitespaceScrutinizer() { public WhitespaceScrutinizer() {
_issuesMap = new HashMap<>(); _issuesMap = new HashMap<>();
_issuesMap.put(leadingWhitespaceType, Pattern.compile("^\\s"));
_issuesMap.put(trailingWhitespaceType, Pattern.compile("\\s$"));
_issuesMap.put(duplicateWhitespaceType, Pattern.compile("\\s\\s")); _issuesMap.put(duplicateWhitespaceType, Pattern.compile("\\s\\s"));
// https://stackoverflow.com/questions/14565934/regular-expression-to-remove-all-non-printable-characters // https://stackoverflow.com/questions/14565934/regular-expression-to-remove-all-non-printable-characters

View File

@ -53,7 +53,7 @@ public class WbMonolingualExpr implements WbExpression<MonolingualTextValue> {
String text = getValueExpr().evaluate(ctxt).getString(); String text = getValueExpr().evaluate(ctxt).getString();
try { try {
String lang = getLanguageExpr().evaluate(ctxt); String lang = getLanguageExpr().evaluate(ctxt);
return Datamodel.makeMonolingualTextValue(text, lang); return Datamodel.makeMonolingualTextValue(text.trim(), lang);
} catch (SkipSchemaExpressionException e) { } catch (SkipSchemaExpressionException e) {
QAWarning warning = new QAWarning("monolingual-text-without-language", null, QAWarning.Severity.WARNING, 1); QAWarning warning = new QAWarning("monolingual-text-without-language", null, QAWarning.Severity.WARNING, 1);

View File

@ -39,7 +39,7 @@ public class WbStringConstant implements WbExpression<StringValue> {
Validate.notNull(value); Validate.notNull(value);
Validate.isTrue(!value.isEmpty()); // for now we don't accept empty strings Validate.isTrue(!value.isEmpty()); // for now we don't accept empty strings
// because in the variable counterpart of this expression, they are skipped // because in the variable counterpart of this expression, they are skipped
this.value = value; this.value = value.trim();
} }
@Override @Override

View File

@ -62,7 +62,7 @@ public class WbStringVariable extends WbVariableExpr<StringValue> {
if (cell.value instanceof Double && ((Double)cell.value) % 1 == 0) { if (cell.value instanceof Double && ((Double)cell.value) % 1 == 0) {
stringValue = Integer.toString(((Double)cell.value).intValue()); stringValue = Integer.toString(((Double)cell.value).intValue());
} }
return Datamodel.makeStringValue(stringValue); return Datamodel.makeStringValue(stringValue.trim());
} }
throw new SkipSchemaExpressionException(); throw new SkipSchemaExpressionException();
} }

View File

@ -0,0 +1,30 @@
package org.openrefine.wikidata.exporters;
import static org.openrefine.wikidata.testing.JacksonSerializationTest.assertJsonEquals;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Properties;
import org.testng.annotations.Test;
import com.google.refine.browsing.Engine;
import com.google.refine.model.Project;
import com.google.refine.tests.RefineTest;
public class SchemaExporterTest extends RefineTest {
private SchemaExporter exporter = new SchemaExporter();
@Test
public void testNoSchema()
throws IOException {
Project project = this.createCSVProject("a,b\nc,d");
Engine engine = new Engine(project);
StringWriter writer = new StringWriter();
Properties properties = new Properties();
exporter.export(project, properties, engine, writer);
assertJsonEquals("{\"itemDocuments\":[]}", writer.toString());
}
}

View File

@ -33,18 +33,6 @@ public class WhitespaceScrutinizerTest extends ValueScrutinizerTest {
return new WhitespaceScrutinizer(); return new WhitespaceScrutinizer();
} }
@Test
public void testLeadingWhitespace() {
scrutinize(Datamodel.makeStringValue(" a"));
assertWarningsRaised(WhitespaceScrutinizer.leadingWhitespaceType);
}
@Test
public void testTrailingWhitespace() {
scrutinize(Datamodel.makeStringValue("a\t"));
assertWarningsRaised(WhitespaceScrutinizer.trailingWhitespaceType);
}
@Test @Test
public void testDuplicateWhitespace() { public void testDuplicateWhitespace() {
scrutinize(Datamodel.makeStringValue("a\t b")); scrutinize(Datamodel.makeStringValue("a\t b"));
@ -65,14 +53,13 @@ public class WhitespaceScrutinizerTest extends ValueScrutinizerTest {
@Test @Test
public void testMultipleIssues() { public void testMultipleIssues() {
scrutinize(Datamodel.makeStringValue(" a\t b ")); scrutinize(Datamodel.makeStringValue("a\t b\u0003"));
assertWarningsRaised(WhitespaceScrutinizer.duplicateWhitespaceType, WhitespaceScrutinizer.leadingWhitespaceType, assertWarningsRaised(WhitespaceScrutinizer.duplicateWhitespaceType, WhitespaceScrutinizer.nonPrintableCharsType);
WhitespaceScrutinizer.trailingWhitespaceType);
} }
@Test @Test
public void testMonolingualTextValue() { public void testMonolingualTextValue() {
scrutinizeLabel(Datamodel.makeMonolingualTextValue(" a", "fr")); scrutinizeLabel(Datamodel.makeMonolingualTextValue("a b", "fr"));
assertWarningsRaised(WhitespaceScrutinizer.leadingWhitespaceType); assertWarningsRaised(WhitespaceScrutinizer.duplicateWhitespaceType);
} }
} }

View File

@ -44,6 +44,12 @@ public class WbMonolingualExprTest extends WbExpressionTest<MonolingualTextValue
evaluatesTo(Datamodel.makeMonolingualTextValue("hello", "en"), expr); evaluatesTo(Datamodel.makeMonolingualTextValue("hello", "en"), expr);
} }
@Test
public void testTrim() {
setRow("en", " hello ");
evaluatesTo(Datamodel.makeMonolingualTextValue("hello", "en"), expr);
}
@Test @Test
public void testInvalidLanguageCode() { public void testInvalidLanguageCode() {
setRow("ueuue", "my label"); setRow("ueuue", "my label");

View File

@ -20,6 +20,11 @@ public class WbStringConstantTest extends WbExpressionTest<StringValue> {
evaluatesTo(Datamodel.makeStringValue("hello world"), constant); evaluatesTo(Datamodel.makeStringValue("hello world"), constant);
} }
@Test
public void testTrim() {
evaluatesTo(Datamodel.makeStringValue("hello world"), new WbStringConstant(" hello world "));
}
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testEmpty() { public void testEmpty() {
new WbStringConstant(""); new WbStringConstant("");

View File

@ -47,12 +47,11 @@ public class WbStringVariableTest extends WbVariableTest<StringValue> {
} }
/** /**
* It is not up to the evaluator to clean up the strings it gets. This is * The evaluator cleans up leading and trailing whitespace, but not duplicate spaces
* flagged later on by scrutinizers.
*/ */
@Test @Test
public void testTrailingWhitespace() { public void testTrailingWhitespace() {
evaluatesTo(Datamodel.makeStringValue("dirty \t"), "dirty \t"); evaluatesTo(Datamodel.makeStringValue("dirty"), "dirty \t");
} }
/** /**
@ -74,7 +73,7 @@ public class WbStringVariableTest extends WbVariableTest<StringValue> {
@Test @Test
public void testLeadingWhitespace() { public void testLeadingWhitespace() {
evaluatesTo(Datamodel.makeStringValue(" dirty"), " dirty"); evaluatesTo(Datamodel.makeStringValue("dirty"), " dirty");
} }
@Test @Test

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>main</artifactId> <artifactId>main</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - main</name> <name>OpenRefine - main</name>
<description>OpenRefine is a free, open source power tool for working with messy data and improving it</description> <description>OpenRefine is a free, open source power tool for working with messy data and improving it</description>

View File

@ -60,7 +60,7 @@ import edu.mit.simile.butterfly.Butterfly;
import edu.mit.simile.butterfly.ButterflyModule; import edu.mit.simile.butterfly.ButterflyModule;
public class RefineServlet extends Butterfly { public class RefineServlet extends Butterfly {
static private String ASSIGNED_VERSION = "3.0"; static private String ASSIGNED_VERSION = "3.1-beta";
static public String VERSION = ""; static public String VERSION = "";
static public String REVISION = ""; static public String REVISION = "";

View File

@ -305,6 +305,7 @@ public class ListFacet implements Facet {
*/ */
NominalFacetChoice choice = new NominalFacetChoice(decoratedValue); NominalFacetChoice choice = new NominalFacetChoice(decoratedValue);
choice.count = 0; choice.count = 0;
choice.selected = true;
_choices.add(choice); _choices.add(choice);
} }
} }

View File

@ -37,8 +37,10 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.TimeZone; import java.util.TimeZone;
@ -59,10 +61,16 @@ public class ToDate implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
String o1; String o1;
Boolean month_first = null;
List<String> formats = new ArrayList<String>();
OffsetDateTime date = null;
//Check there is at least one argument
if (args.length == 0) { if (args.length == 0) {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects at least one argument"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects at least one argument");
} else { } else {
Object arg0 = args[0]; Object arg0 = args[0];
//check the first argument is something that can be parsed as a date
if (arg0 instanceof OffsetDateTime) { if (arg0 instanceof OffsetDateTime) {
return arg0; return arg0;
} else if (arg0 instanceof Long) { } else if (arg0 instanceof Long) {
@ -75,76 +83,95 @@ public class ToDate implements Function {
} }
} }
// "o, boolean month_first (optional)" if(args.length==1) {
if (args.length == 1 || (args.length == 2 && args[1] instanceof Boolean)) { date = parse(o1,true,formats);
boolean month_first = true; } else if (args.length > 1) {
if (args.length == 2) { if(args[1] instanceof Boolean) {
month_first = (Boolean) args[1]; month_first = (Boolean) args[1];
} } else if (args[1] instanceof String) {
try { formats.add(StringUtils.trim((String) args[1]));
return CalendarParser.parseAsOffsetDateTime( o1, (month_first) ? CalendarParser.MM_DD_YY : CalendarParser.DD_MM_YY);
} catch (CalendarParserException e) {
OffsetDateTime d = ParsingUtilities.stringToDate(o1);
if (d != null) {
return d;
} else { } else {
try { return new EvalError("Invalid argument");
return javax.xml.bind.DatatypeConverter.parseDateTime(o1).getTime().toInstant().atOffset(ZoneOffset.of("Z"));
} catch (IllegalArgumentException e2) {
} }
} for(int i=2;i<args.length;i++) {
return new EvalError("Unable to parse as date");
}
} else if (args.length>=2) {
// "o, format1, format2 (optional), ..."
Locale locale = Locale.getDefault();
for (int i=1;i<args.length;i++) {
if (!(args[i] instanceof String)) { if (!(args[i] instanceof String)) {
// skip formats that aren't strings // skip formats that aren't strings
continue; continue;
} }
String format = StringUtils.trim((String) args[i]); formats.add(StringUtils.trim((String) args[i]));
DateFormat formatter;
// Attempt to parse first string as a language tag
if (i == 1) {
Locale possibleLocale = Locale.forLanguageTag(format); // Java 1.7+
boolean valid = false;
for (Locale l : DateFormat.getAvailableLocales()) {
if (l.equals(possibleLocale)) {
locale = possibleLocale;
valid = true;
break;
} }
} if(month_first != null) {
if (valid) { // If we got a valid locale date = parse(o1,month_first,formats);
if (args.length == 2) { // No format strings to try, process using default
formatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
OffsetDateTime date = parse(o1, formatter);
if (date != null) {
return date;
} else { } else {
return new EvalError("Unable to parse as date"); date = parse(o1,formats);
}
}
continue; // Don't try to process locale string as a format string if it was valid
}
}
try {
formatter = new SimpleDateFormat(format,locale);
} catch (IllegalArgumentException e) {
return new EvalError("Unknown date format");
}
formatter.setLenient(true);
OffsetDateTime date = parse(o1, formatter);
if (date != null) {
return date;
} }
} }
return new EvalError("Unable to parse as date"); if(date != null) {
return date;
}
return new EvalError("Unable to convert to a date");
}
private OffsetDateTime parse(String o1, Boolean month_first, List<String> formats) {
if(month_first != null) {
try {
return CalendarParser.parseAsOffsetDateTime( o1, (month_first) ? CalendarParser.MM_DD_YY : CalendarParser.DD_MM_YY);
} catch (CalendarParserException e) {
}
}
return parse(o1,formats);
}
private OffsetDateTime parse(String o1, List<String> formats) {
if(formats.size()>0) {
String f1 = formats.get(0);
formats.remove(0);
return parse(o1,f1,formats);
} else { } else {
return new EvalError("Unable to parse as date"); return parse(o1,Locale.getDefault(),formats);
}
}
private OffsetDateTime parse(String o1, String f1, List<String> formats) {
Locale locale = Locale.getDefault();
Locale possibleLocale = Locale.forLanguageTag(f1); // Java 1.7+
for (Locale l : DateFormat.getAvailableLocales()) {
if (l.equals(possibleLocale)) {
locale = possibleLocale;
} else {
formats.add(0,f1);
}
}
return parse(o1,locale,formats);
}
private OffsetDateTime parse(String o1, Locale locale, List<String> formats) {
DateFormat formatter;
OffsetDateTime date;
//need to try using each format in the formats list!
if(formats.size()>0) {
for(int i=0;i<formats.size();i++) {
try {
formatter = new SimpleDateFormat(formats.get(i),locale);
} catch (IllegalArgumentException e) {
continue;
}
date = parse(o1, formatter);
if (date != null) {
return date;
}
}
}
date = ParsingUtilities.stringToDate(o1);
if (date != null) {
return date;
} else {
try {
return javax.xml.bind.DatatypeConverter.parseDateTime(o1).getTime().toInstant().atOffset(ZoneOffset.of("Z"));
} catch (IllegalArgumentException e2) {
return null;
}
} }
} }

View File

@ -43,6 +43,18 @@ public class ListFacetTests extends RefineTest {
+ " {\"v\":{\"v\":\"barbar\",\"l\":\"barbar\"},\"c\":1,\"s\":false}" + " {\"v\":{\"v\":\"barbar\",\"l\":\"barbar\"},\"c\":1,\"s\":false}"
+ "]}"; + "]}";
private static String selectedEmptyChoiceFacet = "{"
+ "\"name\":\"facet A\","
+ "\"expression\":\"value+\\\"bar\\\"\","
+ "\"columnName\":\"Column A\","
+ "\"invert\":false,"
+ "\"choices\":["
+ " {\"v\":{\"v\":\"ebar\",\"l\":\"ebar\"},\"c\":1,\"s\":false},"
+ " {\"v\":{\"v\":\"cbar\",\"l\":\"cbar\"},\"c\":1,\"s\":false},"
+ " {\"v\":{\"v\":\"abar\",\"l\":\"abar\"},\"c\":1,\"s\":false},"
+ " {\"v\":{\"v\":\"foobar\",\"l\":\"true\"},\"c\":0,\"s\":true}"
+ "]}";
@Test @Test
public void serializeListFacetConfig() { public void serializeListFacetConfig() {
ListFacetConfig facetConfig = new ListFacetConfig(); ListFacetConfig facetConfig = new ListFacetConfig();
@ -77,4 +89,19 @@ public class ListFacetTests extends RefineTest {
Facet facet = facetConfig.apply(project); Facet facet = facetConfig.apply(project);
TestUtils.isSerializedTo(facet, jsonFacetError); TestUtils.isSerializedTo(facet, jsonFacetError);
} }
@Test
public void testSelectedEmptyChoice() {
Project project = createCSVProject("Column A\n" +
"a\n" +
"c\n" +
"e");
Engine engine = new Engine(project);
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
facet.computeChoices(project, engine.getAllFilteredRows());
TestUtils.isSerializedTo(facet, selectedEmptyChoiceFacet);
}
} }

View File

@ -138,17 +138,36 @@ public class ToFromConversionTests extends RefineTest {
Assert.assertTrue(invoke("toDate", (Object) null) instanceof EvalError); Assert.assertTrue(invoke("toDate", (Object) null) instanceof EvalError);
Assert.assertTrue(invoke("toDate", "") instanceof EvalError); Assert.assertTrue(invoke("toDate", "") instanceof EvalError);
Assert.assertTrue(invoke("toDate", 1.0) instanceof EvalError); Assert.assertTrue(invoke("toDate", 1.0) instanceof EvalError);
Assert.assertTrue(invoke("toDate", "2012-03-01","xxx") instanceof EvalError); // bad format string //Assert.assertTrue(invoke("toDate", "2012-03-01","xxx") instanceof EvalError); // bad format string
Assert.assertTrue(invoke("toDate", "2012-03-01") instanceof OffsetDateTime); Assert.assertTrue(invoke("toDate", "2012-03-01") instanceof OffsetDateTime);
Assert.assertEquals(invoke("toDate", "2012-03-01"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); Assert.assertEquals(invoke("toDate", "2012-03-01"),CalendarParser.parseAsOffsetDateTime("2012-03-01"));
//parse as 'month first' date with and without explicit 'true' parameter
Assert.assertEquals(invoke("toDate", "01/03/2012"),CalendarParser.parseAsOffsetDateTime("2012-01-03"));
Assert.assertEquals(invoke("toDate", "01/03/2012",true),CalendarParser.parseAsOffsetDateTime("2012-01-03"));
//parse as 'month first' date with 'false' parameter
Assert.assertEquals(invoke("toDate", "01/03/2012",false),CalendarParser.parseAsOffsetDateTime("2012-03-01"));
//parse as 'month first' date without 'false' parameter but with format specified
Assert.assertEquals(invoke("toDate", "01/03/2012","dd/MM/yyyy"),CalendarParser.parseAsOffsetDateTime("2012-03-01"));
Assert.assertEquals(invoke("toDate", "2012-03-01","yyyy-MM-dd"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); Assert.assertEquals(invoke("toDate", "2012-03-01","yyyy-MM-dd"),CalendarParser.parseAsOffsetDateTime("2012-03-01"));
//Two digit year
Assert.assertEquals(invoke("toDate", "02-02-01"),CalendarParser.parseAsOffsetDateTime("2001-02-02"));
// Multiple format strings should get tried sequentially until one succeeds or all are exhausted // Multiple format strings should get tried sequentially until one succeeds or all are exhausted
Assert.assertEquals(invoke("toDate", "2012-03-01","MMM","yyyy-MM-dd"), CalendarParser.parseAsOffsetDateTime("2012-03-01")); Assert.assertEquals(invoke("toDate", "2012-03-01","MMM","yyyy-MM-dd"), CalendarParser.parseAsOffsetDateTime("2012-03-01"));
// Boolean argument combined with Multiple format strings
Assert.assertEquals(invoke("toDate", "01/03/2012",false, "MMM","yyyy-MM-dd","MM/dd/yyyy"), CalendarParser.parseAsOffsetDateTime("2012-03-01"));
// First string can be a locale identifier instead of a format string // First string can be a locale identifier instead of a format string
Assert.assertEquals(invoke("toDate", "2013-06-01","zh"), CalendarParser.parseAsOffsetDateTime("2013-06-01"));
Assert.assertEquals(invoke("toDate", "01-六月-2013","zh","dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); Assert.assertEquals(invoke("toDate", "01-六月-2013","zh","dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01"));
//if invalid format/locale strings are passed, ignore them
Assert.assertEquals(invoke("toDate", "2012-03-01","XXX"), CalendarParser.parseAsOffsetDateTime("2012-03-01"));
// If a long, convert to string
Assert.assertEquals(invoke("toDate", (long) 2012), CalendarParser.parseAsOffsetDateTime("2012-01-01"));
// If already a date, leave it alone
Assert.assertEquals(invoke("toDate", CalendarParser.parseAsOffsetDateTime("2012-03-01")),CalendarParser.parseAsOffsetDateTime("2012-03-01"));
} }
@Test @Test

View File

@ -0,0 +1,11 @@
{
"core-index": {
"help": "সাহায্য",
"about": "সম্বন্ধে",
"version": "সংস্করণ",
"new-version": "নতুন সংকরণ!",
"download": "ডাউনলোড করুন",
"now": "এখন",
"preferences": "পছন্দসমূহ"
}
}

View File

@ -40,7 +40,6 @@ Encoding.selectEncoding = function(input, onDone) {
var level = DialogSystem.showDialog(frame); var level = DialogSystem.showDialog(frame);
$("#select-encodings-tabs").tabs({ selected: 0 }); $("#select-encodings-tabs").tabs({ selected: 0 });
$("#select-encodings-tabs-all").css("display", "");
elmts.dialogHeader.text($.i18n._('core-util-enc')["select-enc"]); elmts.dialogHeader.text($.i18n._('core-util-enc')["select-enc"]);
elmts.cancelButton.text($.i18n._('core-buttons')["cancel"]); elmts.cancelButton.text($.i18n._('core-buttons')["cancel"]);

View File

@ -1,10 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>packaging</artifactId> <artifactId>packaging</artifactId>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - packaging</name> <name>OpenRefine - packaging</name>
<description>Creates packages for all supported operating systems</description> <description>Creates packages for all supported operating systems</description>
<url>http://openrefine.org/</url> <url>http://openrefine.org/</url>
@ -218,6 +215,39 @@
</plugin> </plugin>
</plugins> </plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>[1.4,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>

59
pom.xml
View File

@ -150,9 +150,68 @@
</configuration> </configuration>
</plugin> </plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-install-plugin
</artifactId>
<versionRange>[2.5.2,)</versionRange>
<goals>
<goal>install-file</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-install-plugin
</artifactId>
<versionRange>[2.5.2,)</versionRange>
<goals>
<goal>install-file</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>

View File

@ -184,7 +184,8 @@ set REFINE_LIB_DIR=server\target\lib
rem ----- Respond to the action ---------------------------------------------------------- rem ----- Respond to the action ----------------------------------------------------------
set ACTION=%1 set ACTION=%1
setlocal
%@Try%
if ""%ACTION%"" == ""build"" goto doMvn if ""%ACTION%"" == ""build"" goto doMvn
if ""%ACTION%"" == ""server_test"" goto doMvn if ""%ACTION%"" == ""server_test"" goto doMvn
if ""%ACTION%"" == ""extensions_test"" goto doMvn if ""%ACTION%"" == ""extensions_test"" goto doMvn
@ -192,6 +193,11 @@ if ""%ACTION%"" == ""test"" goto doMvn
if ""%ACTION%"" == ""clean"" goto doMvn if ""%ACTION%"" == ""clean"" goto doMvn
if ""%ACTION%"" == ""distclean"" goto doMvn if ""%ACTION%"" == ""distclean"" goto doMvn
if ""%ACTION%"" == ""run"" goto doRun if ""%ACTION%"" == ""run"" goto doRun
%@EndTry%
:@Catch
echo Unknown Refine command called "%1", type "refine /?" for proper usage.
exit /B 1
:@EndCatch
:doRun :doRun
rem --- Log for troubleshooting ------------------------------------------ rem --- Log for troubleshooting ------------------------------------------

View File

@ -2,10 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openrefine</groupId>
<artifactId>server</artifactId> <artifactId>server</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.1-SNAPSHOT</version>
<name>OpenRefine - server</name> <name>OpenRefine - server</name>
<description>OpenRefine is a free, open source power tool for working with messy data and improving it</description> <description>OpenRefine is a free, open source power tool for working with messy data and improving it</description>
@ -73,6 +71,16 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<mainClass>com.google.refine.Refine</mainClass>
<commandlineArgs>-Drefine.headless=true -Drefine.autoreload=true -Dbutterfly.autoreload=true -Drefine.memory=1400M -Drefine.port=3333 -Drefine.host=127.0.0.1</commandlineArgs>
<skip>false</skip>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -126,6 +134,35 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-install-plugin
</artifactId>
<versionRange>[2.5.2,)</versionRange>
<goals>
<goal>install-file</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>