/** * 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(EntityRedirectDocument o) { return "==EntityRedirect " + o.getEntityId().getIri() + " (r" + o.getRevisionId() + ") " + "==\n" + "Target: " + o.getTargetId().getIri(); } }
/** * Writes OWL declarations for classes that have been added recently. * Declared classes are stored so that duplicate declarations are avoided. * * @param rdfWriter * the writer to write the declarations to * @throws RDFHandlerException * if there was a problem writing the declarations */ public void writeClassDeclarations(RdfWriter rdfWriter) throws RDFHandlerException { for (EntityIdValue entityIdValue : this.classEntityQueue) { if (!this.declaredClassEntities.add(entityIdValue)) { continue; } rdfWriter.writeTripleValueObject(entityIdValue.getIri(), RdfWriter.RDF_TYPE, RdfWriter.OWL_CLASS); } this.classEntityQueue.clear(); }
/** * 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(EntityRedirectDocument o) { return "==EntityRedirect " + o.getEntityId().getIri() + " (r" + o.getRevisionId() + ") " + "==\n" + "Target: " + o.getTargetId().getIri(); } }
/** * Get the URI for the given statement. * * @param statement * the statement for which to create a URI * @return the URI */ public static String getStatementUri(Statement statement) { int i = statement.getStatementId().indexOf('$') + 1; return statement.getClaim().getSubject().getIri() + "S" + statement.getStatementId().substring(i); }
/** * Constructor. * * @param id * the identifier of the subject of this document * @param claims * the statement groups contained in this document * @param revisionId * the id of the last revision of this document */ StatementDocumentImpl( EntityIdValue id, List<StatementGroup> claims, long revisionId) { super(id, revisionId); this.claims = new HashMap<>(); if(claims != null) { for(StatementGroup group : claims) { EntityIdValue otherId = group.getSubject(); otherId.getIri(); Validate.isTrue(group.getSubject().equals(id), "Subject for the statement group and the document are different: "+otherId.toString()+" vs "+id.toString()); this.claims.put(group.getProperty().getId(), group.getStatements()); } } }
/** * Constructor. * * @param id * the identifier of the subject of this document * @param claims * the statement groups contained in this document * @param revisionId * the id of the last revision of this document */ StatementDocumentImpl( EntityIdValue id, List<StatementGroup> claims, long revisionId) { super(id, revisionId); this.claims = new HashMap<>(); if(claims != null) { for(StatementGroup group : claims) { EntityIdValue otherId = group.getSubject(); otherId.getIri(); Validate.isTrue(group.getSubject().equals(id), "Subject for the statement group and the document are different: "+otherId.toString()+" vs "+id.toString()); this.claims.put(group.getProperty().getId(), group.getStatements()); } } }
@Override public Value getRdfValue(EntityIdValue value, PropertyIdValue propertyIdValue, boolean simple) { String datatype = this.propertyTypes.setPropertyTypeFromEntityIdValue( propertyIdValue, value); switch (datatype) { case DatatypeIdValue.DT_ITEM: this.rdfConversionBuffer.addObjectProperty(propertyIdValue); return this.rdfWriter.getUri(value.getIri()); default: logIncompatibleValueError(propertyIdValue, datatype, "entity"); return null; } }
@Override public Value getRdfValue(EntityIdValue value, PropertyIdValue propertyIdValue, boolean simple) { String datatype = this.propertyRegister .setPropertyTypeFromEntityIdValue(propertyIdValue, value); switch (datatype) { case DatatypeIdValue.DT_ITEM: case DatatypeIdValue.DT_PROPERTY: case DatatypeIdValue.DT_LEXEME: case DatatypeIdValue.DT_FORM: case DatatypeIdValue.DT_SENSE: if (simple) { this.rdfConversionBuffer.addObjectProperty(propertyIdValue); return this.rdfWriter.getUri(value.getIri()); } else { return null; // or blank node } default: logIncompatibleValueError(propertyIdValue, datatype, "entity"); return null; } } }
+ entityIdValue.getIri());
+ entityIdValue.getIri());
public void writePropertyDocument(PropertyDocument document) throws RDFHandlerException { propertyTypes.setPropertyType(document.getPropertyId(), document .getDatatype().getIri()); if (!hasTask(RdfSerializer.TASK_PROPERTIES)) { return; } String propertyUri = document.getEntityId().getIri(); Resource subject = this.rdfWriter.getUri(propertyUri); this.rdfWriter.writeTripleValueObject(subject, RdfWriter.RDF_TYPE, RdfWriter.WB_PROPERTY); writeDocumentTerms(subject, document); if (hasTask(RdfSerializer.TASK_DATATYPES)) { this.rdfWriter.writeTripleValueObject(subject, RdfWriter.WB_PROPERTY_TYPE, this.rdfWriter.getUri(document.getDatatype().getIri())); } if (hasTask(RdfSerializer.TASK_STATEMENTS)) { writeStatements(subject, document); } this.snakRdfConverter.writeAuxiliaryTriples(); this.owlDeclarationBuffer.writePropertyDeclarations(this.rdfWriter, hasTask(RdfSerializer.TASK_STATEMENTS), hasTask(RdfSerializer.TASK_SIMPLE_STATEMENTS)); this.referenceRdfConverter.writeReferences(); }
String subjectUri = document.getEntityId().getIri(); Resource subject = this.rdfWriter.getUri(subjectUri);