/** * 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(SomeValueSnak 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(SomeValueSnak o) { return o.getPropertyId().hashCode(); }
/** * Returns true if the parameters are two {@link SomeValueSnak} 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 equalsSomeValueSnak(SomeValueSnak o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } return o2 instanceof SomeValueSnak && o1.getPropertyId().equals(((SomeValueSnak) o2).getPropertyId()); }
/** * Returns true if the parameters are two {@link SomeValueSnak} 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 equalsSomeValueSnak(SomeValueSnak o1, Object o2) { if (o2 == null) { return false; } if (o2 == o1) { return true; } return o2 instanceof SomeValueSnak && o1.getPropertyId().equals(((SomeValueSnak) 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(SomeValueSnak o) { return o.getPropertyId().getIri() + " has some 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(SomeValueSnak o) { return o.getPropertyId().getIri() + " has some value"; }
/** * Copies a {@link SomeValueSnak}. * * @param object * object to copy * @return copied object */ public SomeValueSnak copy(SomeValueSnak object) { return dataObjectFactory.getSomeValueSnak(copy(object.getPropertyId())); }
/** * Copies a {@link SomeValueSnak}. * * @param object * object to copy * @return copied object */ public SomeValueSnak copy(SomeValueSnak object) { return dataObjectFactory.getSomeValueSnak(copy(object.getPropertyId())); }
@Override public Void visit(SomeValueSnak snak) { String rangeUri = getRangeUri(snak.getPropertyId()); if (rangeUri == null) { logger.error("Count not export SomeValueSnak for property " + snak.getPropertyId().getId() + ": OWL range not known."); return null; } String propertyUri = Vocabulary.getPropertyUri(snak.getPropertyId(), this.currentPropertyContext); Resource bnode = this.rdfWriter.getFreshBNode(); addSomeValuesRestriction(bnode, propertyUri, rangeUri); try { this.rdfWriter.writeTripleValueObject(this.currentSubject, RdfWriter.RDF_TYPE, bnode); } catch (RDFHandlerException e) { throw new RuntimeException(e.toString(), e); } return null; }
@Override public Void visit(SomeValueSnak snak) { String rangeUri = getRangeUri(snak.getPropertyId()); if (rangeUri == null) { logger.error("Count not export SomeValueSnak for property " + snak.getPropertyId().getId() + ": OWL range not known."); return null; } String propertyUri = Vocabulary.getPropertyUri(snak.getPropertyId(), this.currentPropertyContext); Resource bnode = this.rdfWriter.getFreshBNode(); addSomeValuesRestriction(bnode, propertyUri, rangeUri); try { this.rdfWriter.writeTripleValueObject(this.currentSubject, RdfWriter.RDF_TYPE, bnode); } catch (RDFHandlerException e) { throw new RuntimeException(e.toString(), e); } return null; }