results = ModelUtils.asCollection(r.get(property.toString())); } else { results = new LinkedHashSet<Object>();
/** * Getter for the id of the Entity the parsed {@link Representation metadata} * are {@link RdfResourceEnum#aboutRepresentation about}. * @param metadata the metadata * @return the id of the entity or <code>null</code> if the parsed {@link Representation} * is <code>null</code> or does not define a value for * {@link RdfResourceEnum#aboutRepresentation} */ public static String getAboutRepresentation(Representation metadata) throws IllegalStateException{ if(metadata == null){ return null; } Iterator<Reference> refs = metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri()); if(refs.hasNext()){ Reference about = refs.next(); if(refs.hasNext()){ log.warn("The parsed Representation {} claims to be the metadata of" + "multiple Entities (entities: {})", metadata.getId(), asCollection(metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri()))); } return about.getReference(); } else { return null; } }
/** * Getter for the id of the Entity the parsed {@link Representation metadata} * are {@link RdfResourceEnum#aboutRepresentation about}. * @param metadata the metadata * @return the id of the entity or <code>null</code> if the parsed {@link Representation} * is <code>null</code> or does not define a value for * {@link RdfResourceEnum#aboutRepresentation} */ public static String getAboutRepresentation(Representation metadata) throws IllegalStateException{ if(metadata == null){ return null; } Iterator<Reference> refs = metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri()); if(refs.hasNext()){ Reference about = refs.next(); if(refs.hasNext()){ log.warn("The parsed Representation {} claims to be the metadata of" + "multiple Entities (entities: {})", metadata.getId(), asCollection(metadata.getReferences(RdfResourceEnum.aboutRepresentation.getUri()))); } return about.getReference(); } else { return null; } }
private void deleteMappingsbyTarget(String id) throws YardException { if(id != null && !id.isEmpty()){ FieldQuery fieldQuery = getQueryFactory().createFieldQuery(); fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id)); deleteEntities(ModelUtils.asCollection( entityhubYard.findReferences(fieldQuery).iterator())); } }
private void deleteMappingsbyTarget(String id) throws YardException { if(id != null && !id.isEmpty()){ FieldQuery fieldQuery = getQueryFactory().createFieldQuery(); fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id)); deleteEntities(ModelUtils.asCollection( entityhubYard.findReferences(fieldQuery).iterator())); } }
Iterator<Reference> types = r.getReferences(TYPE_FIELD); if(types != null && types.hasNext()) { jResult.put("type", new JSONArray(ModelUtils.asCollection(types)));