<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:arch="http://purl.org/archival/vocab/arch#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	exclude-result-prefixes="mods ead xlink" version="2.0">

	<!-- url params -->
	<xsl:param name="uri" select="doc('input:request')/request/request-url"/>
	<xsl:param name="path">
		<xsl:choose>
			<xsl:when test="contains($uri, 'ark:/')">
				<xsl:value-of select="substring-before(substring-after(substring-after($uri, 'ark:/'), '/'), '.rdf')"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring-before(substring-after($uri, 'id/'), '.rdf')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:param>
	<!-- config variables -->
	<xsl:variable name="url" select="/content/config/url"/>
	<xsl:variable name="objectUri">
		<xsl:choose>
			<xsl:when test="//config/ark[@enabled='true']">
				<xsl:value-of select="concat($url, 'ark:/', //config/ark/naan, '/', $path)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($url, 'id/', $path)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	
	<xsl:template match="/">
		<xsl:apply-templates select="/content/*[not(local-name()='config')]"/>
	</xsl:template>

	<xsl:template match="mods:mods|ead:ead">
		<rdf:RDF>
			<xsl:choose>
				<xsl:when test="namespace-uri()='http://www.loc.gov/mods/v3'">
					<xsl:call-template name="mods-content"/>
				</xsl:when>
				<xsl:when test="namespace-uri()='urn:isbn:1-931666-22-9'">
					<xsl:call-template name="ead-content"/>
				</xsl:when>
			</xsl:choose>
		</rdf:RDF>
	</xsl:template>

	<!-- ***************** EAD-TO-RDF ******************-->
	<xsl:template name="ead-content">
		<arch:Collection rdf:about="{$objectUri}">
			<!-- title, creator, abstract, etc. -->
			<xsl:choose>
				<!-- apply templates for immediate did if the child is a component-->
				<xsl:when test="child::ead:c">
					<xsl:apply-templates select="ead:c/ead:did"/>
				</xsl:when>
				<!-- otherwise apply template only to the archdesc/did-->
				<xsl:otherwise>
					<xsl:apply-templates select="ead:archdesc/ead:did"/>
				</xsl:otherwise>
			</xsl:choose>
			
			
			<!-- controlled vocabulary -->
			<xsl:apply-templates select="descendant::ead:subject[@authfilenumber]|descendant::ead:genreform[@authfilenumber]|descendant::ead:geogname[@authfilenumber]|descendant::ead:corpname[@authfilenumber]|descendant::ead:persname[@authfilenumber]"/>
		</arch:Collection>
	</xsl:template>
	
	<xsl:template match="ead:did">
		<xsl:apply-templates select="ead:unittitle|ead:unitid|ead:origination|ead:abstract|ead:extent"/>
	</xsl:template>
	
	<xsl:template match="ead:subject|ead:genreform|ead:origination|ead:geogname">
		<xsl:variable name="element">
			<xsl:choose>
				<xsl:when test="local-name()='subject'">dcterms:subject</xsl:when>
				<xsl:when test="local-name()='genreform'">dcterms:format</xsl:when>
				<xsl:when test="local-name()='persname'">arch:correspondedWith</xsl:when>
				<xsl:when test="local-name()='geogname'">dcterms:coverage</xsl:when>
				<xsl:when test="local-name()='corpname'">dcterms:coverage</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="resource">
			<xsl:choose><commit_msg>tweaked rdf to handle corpname and persname as subjects<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:arch="http://purl.org/archival/vocab/arch#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	exclude-result-prefixes="mods ead xlink" version="2.0">

	<!-- url params -->
	<xsl:param name="uri" select="doc('input:request')/request/request-url"/>
	<xsl:param name="path">
		<xsl:choose>
			<xsl:when test="contains($uri, 'ark:/')">
				<xsl:value-of select="substring-before(substring-after(substring-after($uri, 'ark:/'), '/'), '.rdf')"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring-before(substring-after($uri, 'id/'), '.rdf')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:param>
	<!-- config variables -->
	<xsl:variable name="url" select="/content/config/url"/>
	<xsl:variable name="objectUri">
		<xsl:choose>
			<xsl:when test="//config/ark[@enabled='true']">
				<xsl:value-of select="concat($url, 'ark:/', //config/ark/naan, '/', $path)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($url, 'id/', $path)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	
	<xsl:template match="/">
		<xsl:apply-templates select="/content/*[not(local-name()='config')]"/>
	</xsl:template>

	<xsl:template match="mods:mods|ead:ead">
		<rdf:RDF>
			<xsl:choose>
				<xsl:when test="namespace-uri()='http://www.loc.gov/mods/v3'">
					<xsl:call-template name="mods-content"/>
				</xsl:when>
				<xsl:when test="namespace-uri()='urn:isbn:1-931666-22-9'">
					<xsl:call-template name="ead-content"/>
				</xsl:when>
			</xsl:choose>
		</rdf:RDF>
	</xsl:template>

	<!-- ***************** EAD-TO-RDF ******************-->
	<xsl:template name="ead-content">
		<arch:Collection rdf:about="{$objectUri}">
			<!-- title, creator, abstract, etc. -->
			<xsl:choose>
				<!-- apply templates for immediate did if the child is a component-->
				<xsl:when test="child::ead:c">
					<xsl:apply-templates select="ead:c/ead:did"/>
				</xsl:when>
				<!-- otherwise apply template only to the archdesc/did-->
				<xsl:otherwise>
					<xsl:apply-templates select="ead:archdesc/ead:did"/>
				</xsl:otherwise>
			</xsl:choose>
			
			
			<!-- controlled vocabulary -->
			<xsl:apply-templates select="descendant::ead:subject[@authfilenumber]|descendant::ead:genreform[@authfilenumber]|descendant::ead:geogname[@authfilenumber]|descendant::ead:corpname[@authfilenumber]|descendant::ead:persname[@authfilenumber]"/>
		</arch:Collection>
	</xsl:template>
	
	<xsl:template match="ead:did">
		<xsl:apply-templates select="ead:unittitle|ead:unitid|ead:origination|ead:abstract|ead:extent"/>
	</xsl:template>
	
	<xsl:template match="ead:subject|ead:genreform|ead:origination|ead:geogname|ead:persname|ead:corpname">
		<xsl:variable name="element">
			<xsl:choose>
				<xsl:when test="local-name()='subject'">dcterms:subject</xsl:when>
				<xsl:when test="local-name()='genreform'">dcterms:format</xsl:when>
				<xsl:when test="local-name()='persname'">dcterms:subject</xsl:when>
				<xsl:when test="local-name()='geogname'">dcterms:coverage</xsl:when>
				<xsl:when test="local-name()='corpname'">dcterms:subject</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="resource">
			<xsl:choose>
{'fraction_non_alphanumeric': 0.2358375220758049, 'fraction_numerical': 0.0190191550061133, 'mean_word_length': 5.0294840294840295, 'pattern_counts': {'":': 0, '<': 161, '<?xml version=': 2, '>': 161, 'https://': 0, 'lorem ipsum': 0, 'www.': 18, 'xml': 30}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5510369', 'n_tokens_mistral': 3300, 'n_tokens_neox': 2733, 'n_words': 325}