<?xml-model uri="https://xtriples.lod.academy/xtriples.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<xtriples>
    <configuration>
        <vocabularies>
            <vocabulary prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
            <vocabulary prefix="cd" uri="http://correspsearch.bbaw.de/ontology/0.1/correspDesc#"/>
            <vocabulary prefix="cs" uri="http://www.bbaw.de/telota/correspSearch"/>
            <vocabulary prefix="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
            <vocabulary prefix="rdfs" uri="http://www.w3.org/2000/01/rdf-schema#"/>
            <vocabulary prefix="foaf" uri="http://xmlns.com/foaf/0.1/"/>
            <vocabulary prefix="rel" uri="http://purl.org/vocab/relationship/"/>
            <vocabulary prefix="owltime" uri="http://www.w3.org/2006/time#"/>
        </vocabularies>
        <triples>
			<!-- a letter -->
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="cd">Letter</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="cd">Letter</object>
            </statement>

        	<!-- dates of a letter -->
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="owltime">TemporalEntity</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="owltime">TemporalEntity</object>
            </statement>
        	<!-- when -->
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="owltime">xsdDateTime</predicate>
                <object type="literal">//tei:date/@when</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="owltime">xsdDateTime</predicate>
                <object type="literal">//tei:date/@when</object>
            </statement>
        	<!-- notBefore -->
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="owltime">after</predicate>
                <object type="literal">//tei:date/@notBefore</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="owltime">after</predicate>
                <object type="literal">//tei:date/@notBefore</object>
            </statement>
        	<!-- notAfter -->
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="owltime">before</predicate>
                <object type="literal">//tei:date/@notAfter</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="owltime">before</predicate>
                <object type="literal">//tei:date/@notAfter</object>
            </statement>

        	<!-- letter sentFrom -->
            <statement>
                <subject>/@ref</subject>
                <predicate prefix="cd">sentFrom</predicate>
                <object type="uri">//tei:correspAction[@type='sent']/tei:placeName/@ref</object>
            </statement>
            <statement>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="cd">sentFrom</predicate>
                <object type="uri">//tei:correspAction[@type='sent']/tei:placeName/@ref</object>
            </statement>
            <statement>
                <subject>//tei:correspAction[@type='sent']/tei:placeName/@ref</subject>
                <predicate prefix="rdfs">label</predicate>
                <object prefix="cd">//tei:correspAction[@type='sent']/tei:placeName/text()</object>
            </statement>

        	<!-- letter receivedAt -->
            <statement>
                <subject>/@ref</subject>
                <predicate prefix="cd">sentTo</predicate>
                <object type="uri">//tei:correspAction[@type='received']/tei:placeName/@ref</object>
            </statement>
            <statement>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="cd">sentTo</predicate>
                <object type="uri">//tei:correspAction[@type='received']/tei:placeName/@ref</object>
            </statement>
            <statement>
                <subject>//tei:correspAction[@type='received']/tei:placeName/@ref</subject>
                <predicate prefix="rdfs">label</predicate>
                <object prefix="cd">//tei:correspAction[@type='received']/tei:placeName/text()</object>
            </statement>

			<!-- sender of a letter (seen from the person as subject)-->
            <statement>
                <subject>//tei:correspAction[@type='sent']/tei:persName/@ref</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="foaf" type="uri">Person</object>
            </statement>
            <statement>
                <subject>//tei:correspAction[@type='sent']/tei:persName/@ref</subject>
                <predicate prefix="rdfs">label</predicate>
                <object type="literal" lang="de">//tei:correspAction[@type='sent']/tei:persName/text()</object>
            </statement>
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>//tei:correspAction[@type='sent']/tei:persName/@ref</subject>
                <predicate prefix="cd">sending</predicate>
                <object type="uri">/@ref</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject>//tei:correspAction[@type='sent']/tei:persName/@ref</subject>
                <predicate prefix="cd">sending</predicate>
                <object type="uri" prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</object>
            </statement>
        	
        	<!-- recipient of a letter (seen from the letter as subject) -->
            <statement>
                <subject>//tei:correspAction[@type='received']/tei:persName/@ref</subject>
                <predicate prefix="rdf">type</predicate>
                <object prefix="foaf" type="uri">Person</object>
            </statement>
            <statement>
                <subject>//tei:correspAction[@type='received']/tei:persName/@ref</subject>
                <predicate prefix="rdfs">label</predicate>
                <object type="literal" lang="de">//tei:correspAction[@type='received']/tei:persName/text()</object>
            </statement>
            <statement>
                <condition>/exists(@ref)</condition>
                <subject>/@ref</subject>
                <predicate prefix="cd">receiving</predicate>
                <object type="uri">//tei:correspAction[@type='received']/tei:persName/@ref</object>
            </statement>
            <statement>
                <condition>/exists(@key)</condition>
                <subject prepend="http://correspsearch.bbaw.de/id/{/substring-after(@cs:source, '#')}/">/@key</subject>
                <predicate prefix="cd">receiving</predicate>
                <object type="uri">//tei:correspAction[@type='received']/tei:persName/@ref</object>
            </statement>
        </triples>
    </configuration>
    <collection uri="https://correspSearch.bbaw.de/api/v1.1/tei-xml.xql?correspondent=http://d-nb.info/gnd/118540238&amp;startdate=1793-01-01&amp;enddate=1808-02-02" max="10">
        <resource uri="{//tei:correspDesc}"/>
    </collection>
</xtriples>