Ejemplo n.º 1
0
  private static void addRelationSet(SolrInputDocument doc, Collection<DcsRelation> set) {
    if (set == null || set.size() == 0) {
      return;
    }

    for (DcsRelation rel : set) {
      setadd(doc, RelationField.TARGET, rel.getRef() == null ? null : rel.getRef().getRef());
      setadd(doc, RelationField.RELATION, rel.getRelUri());

      if (rel.getRef() != null && rel.getRelUri() != null) {
        doc.addField(RELATION_FIELD_PREFIX + rel.getRelUri(), rel.getRef());
      }
    }
  }
Ejemplo n.º 2
0
  private static void addManifestationFileSet(
      SolrInputDocument doc, Collection<DcsManifestationFile> set, ArchiveStore store)
      throws IOException {
    for (DcsManifestationFile mf : set) {

      final String fileRef = mf.getRef() == null ? null : mf.getRef().getRef();
      setadd(doc, ManifestationFileField.FILE_REF, fileRef);
      setadd(doc, ManifestationFileField.PATH, mf.getPath());

      final Collection<DcsRelation> rels = mf.getRelSet();

      if (rels != null && !rels.isEmpty() && fileRef != null) {

        addRelationSet(doc, rels);

        for (DcsRelation rel : rels) {

          // <doc
          // field="mf_rel_urn:dataconservancy.org:file/4326762_hasRelationship">urn:dataconservancy.org:rel/isMetadataFor</doc>
          setadd(
              doc,
              ManifestationFileField.DYNAMIC_MF_REL_PREFIX.solrName()
                  + fileRef
                  + "_"
                  + RelationField.RELATION.solrName(),
              rel.getRelUri());

          // <doc
          // field="mf_rel_urn:dataconservancy.org:file/4326762_relatedTo">http://dataconservancy.org/dcs/entity/article_du</doc>
          setadd(
              doc,
              ManifestationFileField.DYNAMIC_MF_REL_PREFIX.solrName()
                  + fileRef
                  + "_"
                  + RelationField.TARGET.solrName(),
              rel.getRef().getRef());
        }
      }
    }
  }