<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/context  
                        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    

    <bean id="prov20150115.wasDerivedFrom" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_wasDerivedFrom" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>

                SELECT (str(?pidValue) as ?pid) (str(?wasDerivedFromValue) as ?prov_wasDerivedFrom)
                FROM <$GRAPH_NAME>
                WHERE { 
                        
                    ?derived_data       prov:wasDerivedFrom ?primary_data .
                    ?derived_data       dcterms:identifier  ?pidValue . 
                    ?primary_data       dcterms:identifier  ?wasDerivedFromValue .
                        
                    } 
                 ]]>
            </value>
        </constructor-arg>
    </bean>
    
    <bean id="prov20150115.generated" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_generated" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>

                SELECT (str(?pidValue) as ?pid) (str(?generatedValue) as ?prov_generated)
                FROM <$GRAPH_NAME>
                WHERE { 
                        
                    ?result         prov:wasGeneratedBy       ?activity .
                    ?activity       prov:qualifiedAssociation ?association .
                    ?association    prov:hadPlan              ?program .
                    ?result         dcterms:identifier        ?generatedValue . 
                    ?program        dcterms:identifier        ?pidValue .
                        
                    } 
                 ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.wasInformedBy" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_wasInformedBy" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>

                SELECT (str(?pidValue) as ?pid) (str(?wasInformedByValue) as ?prov_wasInformedBy)
                FROM <$GRAPH_NAME>
                WHERE { 
                        
                    ?activity               prov:wasInformedBy  ?previousActivity .
                    ?activity               dcterms:identifier  ?pidValue . 
                    ?previousActivity       dcterms:identifier  ?wasInformedByValue .
                        
                    } 
                 ]]>
            </value>
        </constructor-arg>
    </bean>
    
    <bean id="prov20150115.used" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_used" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>

                SELECT (str(?pidValue) as ?pid) (str(?usedValue) as ?prov_used)
                FROM <$GRAPH_NAME>
                WHERE { 
                        
                    ?activity       prov:used                 ?data .
                    ?activity       prov:qualifiedAssociation ?association .
                    ?association    prov:hadPlan              ?program .
                    ?program        dcterms:identifier        ?pidValue . 
                    ?data           dcterms:identifier        ?usedValue .
                        
                    } 
                 ]]>
            </value>
        </constructor-arg>
    </bean>
    
    <bean id="prov20150115.generatedByProgram" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_generatedByProgram" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) (str(?programPidValue) as ?prov_generatedByProgram)
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?derived_data prov:wasGeneratedBy ?execution .
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:hadPlan ?program .
                    ?program dcterms:identifier ?programPidValue .
                    ?derived_data dcterms:identifier ?pidValue .
                }
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.generatedByExecution" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_generatedByExecution" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) (str(?executionPidValue) as ?prov_generatedByExecution)
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?derived_data prov:wasGeneratedBy ?execution .
                    ?execution dcterms:identifier ?executionPidValue .
                    ?derived_data dcterms:identifier ?pidValue .
                }
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.generatedByUser" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_generatedByUser" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) ?prov_generatedByUser
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?derived_data prov:wasGeneratedBy ?execution .
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:agent ?prov_generatedByUser .
                    ?derived_data dcterms:identifier ?pidValue .
                }
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.usedByProgram" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_usedByProgram" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) (str(?programPidValue) as ?prov_usedByProgram)
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?execution prov:used ?primary_data .
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:hadPlan ?program .
                    ?program dcterms:identifier ?programPidValue .
                    ?primary_data dcterms:identifier ?pidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.usedByExecution" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_usedByExecution" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) (str(?executionIdValue) as ?prov_usedByExecution)
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?execution prov:used ?primary_data .
                    ?primary_data dcterms:identifier ?pidValue .
                    ?execution dcterms:identifier ?executionIdValue .
                }
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.usedByUser" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_usedByUser" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>

                SELECT (str(?pidValue) as ?pid) ?prov_usedByUser
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?execution prov:used ?primary_data .
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:agent ?prov_usedByUser .
                    ?primary_data dcterms:identifier ?pidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.wasExecutedByExecution" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_wasExecutedByExecution" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) (str(?executionIdValue) as ?prov_wasExecutedByExecution)
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:hadPlan ?program .
                    ?execution dcterms:identifier ?executionIdValue .
                    ?program dcterms:identifier ?pidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.wasExecutedByUser" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_wasExecutedByUser" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                                
                SELECT (str(?pidValue) as ?pid) ?prov_wasExecutedByUser
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:hadPlan ?program .
                    ?association prov:agent ?prov_wasExecutedByUser .
                    ?program dcterms:identifier ?pidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <!--  This index field is inteded for use across multiple documents, which requires
          a triple store, which is not currently implemented, so it is disabled for now..
    <bean id="prov20150115.hasSources" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_hasSources" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                PREFIX cito:    <http://purl.org/spar/cito/>
                
                SELECT (str(?pidValue) as ?pid) (str(?sourceDataPidValue) as ?prov_hasSources)
                FROM <$GRAPH_NAME>
                WHERE {
                    ?execution prov:used ?source_data .
                    ?execution prov:qualifiedAssociation ?association .
                    ?association prov:hadPlan ?program .
                    ?program dcterms:identifier ?pidValue .
                    ?source_data dcterms:identifier ?sourceDataPidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>
    -->
    
    <bean id="prov20150115.hasDerivations" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_hasDerivations" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                PREFIX cito:    <http://purl.org/spar/cito/>
                
                SELECT (str(?pidValue) as ?pid) (str(?derivedDataPidValue) as ?prov_hasDerivations)
                FROM <$GRAPH_NAME>
                WHERE {
                    ?derived_data prov:wasDerivedFrom ?source_data .
                    ?source_data dcterms:identifier ?pidValue .
                    ?derived_data dcterms:identifier ?derivedDataPidValue .
                }
                ]]>
            </value>
        </constructor-arg>
    </bean>

    <bean id="prov20150115.instanceOfClass" class="org.dataone.cn.indexer.annotation.SparqlField">
        <constructor-arg name="name" value="prov_instanceOfClass" />
        <constructor-arg name="query">
            <value>
                <![CDATA[
                PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX owl:     <http://www.w3.org/2002/07/owl#> 
                PREFIX prov:    <http://www.w3.org/ns/prov#> 
                PREFIX provone: <http://purl.dataone.org/provone/2015/01/15/ontology#>
                PREFIX ore:     <http://www.openarchives.org/ore/terms/> 
                PREFIX dcterms: <http://purl.org/dc/terms/>
                
                SELECT (str(?pidValue) as ?pid) ?prov_instanceOfClass
                FROM <$GRAPH_NAME>
                WHERE {
                
                    ?subject rdf:type ?prov_instanceOfClass .
                    ?subject dcterms:identifier ?pidValue .
                }                
                ]]>
            </value>
        </constructor-arg>
    </bean>
    
</beans>