Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ao_isad'
Browse files Browse the repository at this point in the history
  • Loading branch information
Basil Marti committed Jul 20, 2017
2 parents 0b725b6 + 73ef105 commit 1527974
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Representation getSearchResult() throws Exception {
SOLRQueryTransformation sQ = new SOLRQueryTransformation();

sQ.setGeneralFilterQuery(this.getGeneralFilterQuery());

sQ.setCurrentSchema(this.schemaType);
HashMap<String,ArrayList<String>> searchMapping = (HashMap<String,ArrayList<String>>) attributes.get("searchMapping");

UtilsCQLRelationsIndexMapping rM = (UtilsCQLRelationsIndexMapping) attributes.get("cqlRelationsMapping");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.swissbib.sru.resources.RequestedSchema;
import org.swissbib.sru.targets.common.BasicQueryTransformation;
import org.swissbib.sru.targets.common.SRUException;
import org.z3950.zing.cql.*;
Expand Down Expand Up @@ -44,6 +45,8 @@ public class SOLRQueryTransformation extends BasicQueryTransformation {

protected String generalFilterQuery = null;

protected RequestedSchema currentSchema;


//private final static SolrServer solrServer;

Expand All @@ -57,6 +60,10 @@ public void setGeneralFilterQuery(String fq) {
this.generalFilterQuery = fq;
}

public void setCurrentSchema (RequestedSchema schema) {
this.currentSchema = schema;
}


//private final String serverURL = "http://search.swissbib.ch/solr/sb-biblio/select?";
//private final String defaultParams = "&wt=xml&indent=true";
Expand Down Expand Up @@ -103,6 +110,10 @@ public QueryResponse runQuery() throws Exception {
System.out.println("invalid rows parameter -> use 10 as default");
}

//if (this.currentSchema == RequestedSchema.aoisadxml) {
// String sort = "author_sort asc" ;
// parameters.set("sort", sort) ;
//}

parameters.set("start",startRecord);
parameters.set("rows", maxRows) ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
<xsl:import href="MARC21slimUtils.nonamespace.xsl"/>
<xsl:output method="xml" indent="yes"/>
<!--
Fixed 530 Removed type="original" from dc:relation 2010-11-19 tmee
Fixed 500 fields. 2006-12-11 ntra
Added ISBN and deleted attributes 6/04 jer
-->
<xsl:template match="/">
<xsl:if test="collection">
<oai_dc:dcCollection xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<xsl:for-each select="collection">
<xsl:for-each select="record">
<oai_dc:dc>
<xsl:apply-templates select="."/>
</oai_dc:dc>
</xsl:for-each>
</xsl:for-each>
</oai_dc:dcCollection>
</xsl:if>
<xsl:if test="record">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:import href="MARC21slimUtils.nonamespace.xsl"/>
<xsl:output method="xml" indent="yes"/>

<xsl:template match="record">

Expand All @@ -31,16 +10,11 @@
<xsl:variable name="dataField856" select="datafield[@tag=856 and @ind1=1]"/>
<xsl:variable name="beginDate008" select="substring($controlField008,8,4)"/>
<xsl:variable name="endDate008" select="substring($controlField008,12,4)"/>

<xsl:variable name="dataField260c" select="datafield[@tag=260]/subfield[@code='c']"/>
<xsl:variable name="dataField046" select="datafield[@tag=046]"/>
<xsl:variable name="beginDate046" select="datafield[@tag=046]/subfield[@code='c']"/>
<xsl:variable name="endDate046" select="datafield[@tag=046]/subfield[@code='e']"/>

<xsl:variable name="dataField593" select="datafield[@tag=593]"/>
<xsl:variable name="divider593" select="'-'"/>

<xsl:variable name="beginDate593" select="translate(substring-before($dataField593,$divider593),'.','-')"/>
<xsl:variable name="endDate593" select="translate(substring-after($dataField593,$divider593),'.','-')"/>

<recordData>

<isad:archivaldescription xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
Expand All @@ -55,19 +29,38 @@
<isad:title xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ab</xsl:with-param>
<xsl:with-param name="delimeter">' : '</xsl:with-param>
<xsl:with-param name="delimeter"> : </xsl:with-param>
</xsl:call-template>
</isad:title>
</xsl:for-each>

<xsl:for-each select="datafield[@tag=260]">
<isad:date xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
</xsl:call-template>
</isad:date>
</xsl:for-each>

<xsl:choose>
<xsl:when test="$dataField260c">
<xsl:for-each select="datafield[@tag=260]">
<isad:date xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
</xsl:call-template>
</isad:date>
</xsl:for-each>
</xsl:when>

<xsl:otherwise>
<xsl:choose>
<xsl:when test="$endDate008=''">
<isad:date xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
<xsl:value-of select="translate($beginDate008, 'u', '')"/>
</isad:date>
</xsl:when>
<xsl:otherwise>
<isad:date xmlns:isad="http://www.expertisecentrumdavid.be/xmlschemas/isad.xsd">
<xsl:value-of select="translate(concat($beginDate008, '-' , $endDate008),'u','')"/>
</isad:date>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

<xsl:choose>
<xsl:when test="datafield[@tag=351]">
<xsl:for-each select="datafield[@tag=351]">
Expand Down Expand Up @@ -191,13 +184,13 @@
</ap:link>

<xsl:choose>
<xsl:when test="$dataField593">
<xsl:when test="$dataField046">
<ap:beginDateISO xmlns:ap="http://www.archivportal.ch/srw/extension/">
<xsl:value-of select="$beginDate593"/>
<xsl:value-of select="$beginDate046"/>
</ap:beginDateISO>

<ap:endDateISO xmlns:ap="http://www.archivportal.ch/srw/extension/">
<xsl:value-of select="$endDate593"/>
<xsl:value-of select="$endDate046"/>
</ap:endDateISO>
</xsl:when>

Expand Down

0 comments on commit 1527974

Please sign in to comment.