/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ public static int hashCode(NoValueSnak o) { return o.getPropertyId().hashCode(); }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ public static int hashCode(NoValueSnak o) { return o.getPropertyId().hashCode(); }
/** * Returns true if the parameters are two {@link NoValueSnak} objects with * exactly the same data. It does not matter if they are different * implementations of the interface as long as their content is the same. * * @param o1 * the first object to compare * @param o2 * the second object to compare * @return true if both objects are equal */ public static boolean equalsNoValueSnak(NoValueSnak o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } return o2 instanceof NoValueSnak && o1.getPropertyId().equals(((NoValueSnak) o2).getPropertyId()); }
/** * Returns true if the parameters are two {@link NoValueSnak} objects with * exactly the same data. It does not matter if they are different * implementations of the interface as long as their content is the same. * * @param o1 * the first object to compare * @param o2 * the second object to compare * @return true if both objects are equal */ public static boolean equalsNoValueSnak(NoValueSnak o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } return o2 instanceof NoValueSnak && o1.getPropertyId().equals(((NoValueSnak) o2).getPropertyId()); }
/** * Returns a human-readable string representation of the given object. * * @see java.lang.Object#toString() * @param o * the object to represent as string * @return a string representation of the object */ public static String toString(NoValueSnak o) { return o.getPropertyId().getIri() + " has no value"; }
/** * Returns a human-readable string representation of the given object. * * @see java.lang.Object#toString() * @param o * the object to represent as string * @return a string representation of the object */ public static String toString(NoValueSnak o) { return o.getPropertyId().getIri() + " has no value"; }
/** * Copies a {@link NoValueSnak}. * * @param object * object to copy * @return copied object */ public NoValueSnak copy(NoValueSnak object) { return dataObjectFactory.getNoValueSnak(copy(object.getPropertyId())); }
/** * Copies a {@link NoValueSnak}. * * @param object * object to copy * @return copied object */ public NoValueSnak copy(NoValueSnak object) { return dataObjectFactory.getNoValueSnak(copy(object.getPropertyId())); }
@Override public Void visit(NoValueSnak snak) { if (simple) { String rangeUri = getRangeUri(snak.getPropertyId()); if (rangeUri == null) { logger.error("Count not export NoValueSnak for property " + snak.getPropertyId().getId() + ": OWL range not known."); return null; if ((this.currentPropertyContext == PropertyContext.QUALIFIER) || (this.currentPropertyContext == PropertyContext.QUALIFIER_SIMPLE)) { noValueClass = Vocabulary.getPropertyUri(snak.getPropertyId(), PropertyContext.NO_QUALIFIER_VALUE); } else { noValueClass = Vocabulary.getPropertyUri(snak.getPropertyId(), PropertyContext.NO_VALUE);
@Override public Void visit(NoValueSnak snak) { String rangeUri = getRangeUri(snak.getPropertyId()); if (rangeUri == null) { logger.error("Count not export NoValueSnak for property " + snak.getPropertyId().getId() + ": OWL range not known."); return null; } else if (!Vocabulary.OWL_THING.equals(rangeUri)) { rangeUri = Vocabulary.RDFS_LITERAL; } String propertyUri = Vocabulary.getPropertyUri(snak.getPropertyId(), this.currentPropertyContext); Resource bnode = this.rdfWriter.getFreshBNode(); addNoValuesRestriction(bnode, propertyUri, rangeUri); try { this.rdfWriter.writeTripleValueObject(this.currentSubject, RdfWriter.RDF_TYPE, bnode); } catch (RDFHandlerException e) { throw new RuntimeException(e.toString(), e); } return null; }