Smalyshev has uploaded a new change for review.
https://gerrit.wikimedia.org/r/205258
Change subject: Relax subject check to only throw is no suitable data is ever
found
......................................................................
Relax subject check to only throw is no suitable data is ever found
Change-Id: Ibb586aae3c5c54a16815667b1ecb2d05334fe6b3
---
M tools/src/main/java/org/wikidata/query/rdf/tool/rdf/Munger.java
1 file changed, 13 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/rdf
refs/changes/58/205258/1
diff --git a/tools/src/main/java/org/wikidata/query/rdf/tool/rdf/Munger.java
b/tools/src/main/java/org/wikidata/query/rdf/tool/rdf/Munger.java
index ccd2143..28bed9a 100644
--- a/tools/src/main/java/org/wikidata/query/rdf/tool/rdf/Munger.java
+++ b/tools/src/main/java/org/wikidata/query/rdf/tool/rdf/Munger.java
@@ -15,6 +15,8 @@
import org.openrdf.model.Statement;
import org.openrdf.model.impl.StatementImpl;
import org.openrdf.model.impl.URIImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.wikidata.query.rdf.common.uri.Ontology;
import org.wikidata.query.rdf.common.uri.Provenance;
import org.wikidata.query.rdf.common.uri.RDF;
@@ -34,6 +36,8 @@
* tightly coupled with Wikibase's export format.
*/
public class Munger {
+ private static final Logger log = LoggerFactory.getLogger(Munger.class);
+
private final WikibaseUris uris;
/**
* Null if not in limit label languages mode and a set of allowed languages
@@ -510,7 +514,15 @@
*/
private void finishCommon() throws ContainedException {
if (!unknownSubjects.isEmpty()) {
- throw new BadSubjectException(unknownSubjects.keySet(), uris);
+ // If we have any valid statements, we ignore the garbage
+ // Otherwise, something wrong is going on and we reject the
update
+ if(statements.isEmpty() && restoredStatements.isEmpty()) {
+ throw new BadSubjectException(unknownSubjects.keySet(),
uris);
+ } else {
+ log.debug(String.format(Locale.ROOT,
+ "Unrecognized subjects: %s. Expected only
sitelinks and subjects starting with %s and %s",
+ unknownSubjects.keySet(), uris.entityData(),
uris.entity()));
+ }
}
if (revisionId == null) {
throw new ContainedException("Didn't get a revision id for " +
statements);
--
To view, visit https://gerrit.wikimedia.org/r/205258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb586aae3c5c54a16815667b1ecb2d05334fe6b3
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits