fcrepo-exts / fcrepo-camel-toolbox

A collection of ready-to-use messaging applications with fcrepo-camel
Apache License 2.0
13 stars 26 forks source link

Make containment configurable #204

Closed whikloj closed 1 week ago

whikloj commented 5 months ago

Add a tracer to see routes in tests

JIRA Ticket: https://fedora-repository.atlassian.net/browse/FCREPO-3939

What does this Pull Request do?

Adds a new configuration argument to allow users to include containment triples in the RDF pulled from Fedora for Solr indexing.

How should this be tested?

Create a custom XSLT that includes a field for containment triples. Before this PR you will never see any triples. After this PR you will still never see any triples. Add the property solr.include.containment=true to your properties file. Now you will see containment triples.

Example XSLT that returns all RDF as a multi-valued field.

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:fedora="http://fedora.info/definitions/v4/repository#"
    xmlns:ldp="http://www.w3.org/ns/ldp#"
    exclude-result-prefixes="rdf fedora ldp"
>

    <xsl:template match="/">
      <xsl:apply-templates select="rdf:RDF/rdf:Description"/>
    </xsl:template>

    <xsl:template match="rdf:Description">
    <add>
        <doc>
            <field name="id"><xsl:value-of select="@rdf:about" /></field>
            <xsl:apply-templates />
        </doc>
    </add>
    </xsl:template>

    <xsl:template match="child::*">
         <field>
           <xsl:attribute name="name"><xsl:value-of select="concat(local-name(), '_ms')"/></xsl:attribute>
           <xsl:choose>
             <xsl:when test="child::text()">
               <xsl:value-of select="child::text()"/>
             </xsl:when>
             <xsl:when test="@rdf:resource">
               <xsl:value-of select="@rdf:resource"/>
             </xsl:when>
             <xsl:otherwise>
               <xsl:comment>This is <xsl:value-of select="local-name()"/></xsl:comment>
             </xsl:otherwise>
           </xsl:choose>
         </field>
    </xsl:template>

</xsl:stylesheet>

Interested parties

Tag (@ mention) interested parties or, if unsure, @fcrepo/committers

whikloj commented 5 months ago

Resolves #202