<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in LICENSE$ -->

<!-- Default list view config file for object properties 
    
     See guidelines at https://wiki.duraspace.org/x/eYXVAw -->

<list-view-config>
    <query-select>    
        PREFIX afn:  &lt;http://jena.apache.org/ARQ/function#&gt;
        PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;  
        PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
        
        SELECT <collated> ?subclass </collated>
               ?object 
               ?label 
               ?localName WHERE {
               
            ?subject ?property ?object
                LET (?localName := afn:localname(?object)) 
                
            OPTIONAL { ?object rdfs:label ?label } 
            
            <collated> 
            OPTIONAL { 
                ?object a ?subclass.
                # Require the subclasses retrieved to be in a classgroup, since others are not generally
                # for display. See vivo-dev-all thread titled "Internal Entity and mostSpecificType,"
                # Aug 9-10, 2011.
                # ?subclass vitro:inClassGroup ?classgroup 
            } 
            FILTER ( afn:namespace(?subclass) != "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" )   
            </collated>       
        
        } ORDER BY <collated> ?subclass </collated> ASC( ?label ) ASC( ?label ) ASC( ?localName )
    </query-select>

    <query-construct>
        PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;  
        PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;

        CONSTRUCT {
            ?subject ?property ?object .
            ?object a ?subclass .
            ?subclass vitro:inClassGroup ?classgroup .
            ?object rdfs:label ?label .
        } WHERE {
            { 
                ?subject ?property ?object 
            } UNION {            
                ?subject ?property ?object .
                ?object a ?subclass . 
            } UNION {
                ?subject ?property ?object .
                ?object a ?subclass .
                ?subclass vitro:inClassGroup ?classgroup 
            } UNION {         
                ?subject ?property ?object .
                ?object rdfs:label ?label .
            }             
        }
    </query-construct>
    
    <template>propStatement-default.ftl</template>
</list-view-config>
