/** * Returns the property id string. Only for use by Jackson during * serialization. * * @return the property id string */ @JsonProperty("property") public String getProperty() { return this.property.getId(); }
@Override public void setPropertyType(PropertyIdValue propertyIdValue, String datatypeIri) { propertyTypes.put(propertyIdValue.getId(), datatypeIri); }
/** * Sets datatypeIri an IRI of the primitive type of an Property for * {@link PropertyIdValue}. * * @param propertyIdValue * @param datatypeIri */ public void setPropertyType(PropertyIdValue propertyIdValue, String datatypeIri) { datatypes.put(propertyIdValue.getId(), datatypeIri); }
/** * Returns the property id string. Only for use by Jackson during * serialization. * * @return the property id string */ @JsonProperty("property") public String getProperty() { return this.property.getId(); }
/** * Logs a message for a case where the value of a property does not fit to * its declared datatype. * * @param propertyIdValue * the property that was used * @param datatype * the declared type of the property * @param valueType * a string to denote the type of value */ protected void logIncompatibleValueError(PropertyIdValue propertyIdValue, String datatype, String valueType) { logger.warn("Property " + propertyIdValue.getId() + " has type \"" + datatype + "\" but a value of type " + valueType + ". Data ignored."); } }
/** * Returns the URI Pattern of a {@link PropertyIdValue} that should be used * to create URIs of external resources from statement values for the * property. * * @param propertyIdValue * property to fetch URI pattern for * @return string pattern using "$1" as a placeholder, or null if no pattern * was found for the given property */ public String getPropertyUriPattern(PropertyIdValue propertyIdValue) { if (!this.datatypes.containsKey(propertyIdValue.getId())) { fetchPropertyInformation(propertyIdValue); } return this.uriPatterns.get(propertyIdValue.getId()); }
/** * Returns the IRI of the primitive type of an {@link PropertyIdValue}. * * @param propertyIdValue * property whose datatype should be fetched * @return URI of the datatype of this property, or null if the type could * not be determined */ public String getPropertyType(PropertyIdValue propertyIdValue) { if (!datatypes.containsKey(propertyIdValue.getId())) { fetchPropertyInformation(propertyIdValue); } return datatypes.get(propertyIdValue.getId()); }
@Override public String getPropertyType(PropertyIdValue propertyIdValue) { if (!propertyTypes.containsKey(propertyIdValue.getId())) { try { propertyTypes.put(propertyIdValue.getId(), fetchPropertyType(propertyIdValue)); } catch (IOException e) { logger.error(e.toString()); } catch (URISyntaxException e) { logger.error(e.toString()); } } return propertyTypes.get(propertyIdValue.getId()); }
/** * Returns a string that should be used as a label for the given property. * * @param propertyIdValue * the property to label * @return the label */ private String getPropertyLabel(PropertyIdValue propertyIdValue) { PropertyRecord propertyRecord = this.propertyRecords .get(propertyIdValue); if (propertyRecord == null || propertyRecord.propertyDocument == null) { return propertyIdValue.getId(); } else { return getLabel(propertyIdValue, propertyRecord.propertyDocument); } }
/** * Constructor. * <p> * The order of the snaks groups provided will be respected. * the properties used by the snak groups should be distinct. * * @param groups * the snaks group which form the reference */ public ReferenceImpl(List<SnakGroup> groups) { propertyOrder = new ArrayList<>(groups.size()); snaks = new HashMap<>(groups.size()); for(SnakGroup group : groups) { propertyOrder.add(group.getProperty().getId()); snaks.put(group.getProperty().getId(), group.getSnaks()); } }
/** * Returns record where statistics about a property should be stored. * * @param property * the property to initialize * @return the property record */ private PropertyRecord getPropertyRecord(PropertyIdValue property) { Integer id = getNumId(property.getId(), false); if (!this.propertyRecords.containsKey(id)) { PropertyRecord propertyRecord = new PropertyRecord(); this.propertyRecords.put(id, propertyRecord); return propertyRecord; } else { return this.propertyRecords.get(id); } }
@Override public SomeValueSnak getSomeValueSnak(PropertyIdValue propertyId) { return new SomeValueSnakImpl( propertyId.getId(), propertyId.getSiteIri()); }
@Override public NoValueSnak getNoValueSnak(PropertyIdValue propertyId) { return new NoValueSnakImpl( propertyId.getId(), propertyId.getSiteIri()); }
/** * Copies a {@link PropertyIdValue}. * * @param object * object to copy * @return copied object */ public PropertyIdValue copy(PropertyIdValue object) { return dataObjectFactory.getPropertyIdValue(object.getId(), object.getSiteIri()); }
/** * Copies a {@link PropertyIdValue}. * * @param object * object to copy * @return copied object */ public PropertyIdValue copy(PropertyIdValue object) { return dataObjectFactory.getPropertyIdValue(object.getId(), object.getSiteIri()); }
@Override public SomeValueSnak getSomeValueSnak(PropertyIdValue propertyId) { return new SomeValueSnakImpl( propertyId.getId(), propertyId.getSiteIri()); }
@Override public NoValueSnak getNoValueSnak(PropertyIdValue propertyId) { return new NoValueSnakImpl( propertyId.getId(), propertyId.getSiteIri()); }
@Override public void processItemDocument(ItemDocument itemDocument) { for (StatementGroup sg : itemDocument.getStatementGroups()) { if (COORD_PROPERTY.equals(sg.getProperty().getId())) { for (Statement s : sg) { countCoordinateStatement(s, itemDocument); } } } }
/** * 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 network connection */ public <T extends StatementDocument> void nullEdit(PropertyIdValue propertyId) throws IOException, MediaWikiApiErrorException { PropertyDocument currentDocument = (PropertyDocument) this.wikibaseDataFetcher .getEntityDocument(propertyId.getId()); nullEdit(currentDocument); }
@Override public void processItemDocument(ItemDocument itemDocument) { for (StatementGroup sg : itemDocument.getStatementGroups()) { if (COORD_PROPERTY.equals(sg.getProperty().getId())) { for (Statement s : sg.getStatements()) { countCoordinateStatement(s, itemDocument); } } } }