From 9687adfd172c446651ba325aa48990762f7f9d28 Mon Sep 17 00:00:00 2001 From: bwbohl Date: Wed, 7 Feb 2024 21:54:33 +0100 Subject: [PATCH 1/2] Update source.xqm --- add/data/xqm/source.xqm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 001ab77cb..102694db3 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -34,20 +34,29 @@ declare namespace mei="http://www.music-encoding.org/ns/mei"; import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util.xqm"; (:~ -: Returns whether a document is a source or not +: Returns whether a document is a source or not. Generally this should work for MEI versions +: 2011-05 through 5.0 : : @param $uri The URI of the document -: @return Is work or not +: +: @return xs:boolean indicating whether the document referenced by @param $uri +: is considered a music source or not. :) declare function source:isSource($uri as xs:string) as xs:boolean { let $doc := eutil:getDoc($uri) - let $meiVersionRegex := '(([4-9])|(\d+[0-9]))\.\d+\.\d+(-dev)?' + let $meiVersion4To5Regex := '^[4-5](\.\d)+(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' + (: 2010-05 pre camelCase :) + (: 2011-05 2012 :) + (: 2013 +meiversion.num 2.1.1:) + (: 3.0.0 :) + (:mei2 and ?3 :) return (exists($doc//mei:mei) and exists($doc//mei:source)) (:mei2 and ?3 :) or - (matches($doc//mei:mei/@meiversion, $meiVersionRegex) and exists($doc//mei:manifestation[@singleton='true'])) (:mei4+ for manuscripts:) + (: MEI 4.0.1 and 5.0 with all dev and cutomization variants :) + (matches($doc//mei:mei/@meiversion, $meiVersion4To5Regex) and exists($doc//mei:manifestation[@singleton='true'])) (:mei4+ for manuscripts:) or - (matches($doc//mei:mei/@meiversion, $meiVersionRegex) and exists($doc//mei:manifestation//mei:item)) (: mei4+ for prints :) + (matches($doc//mei:mei/@meiversion, $meiVersion4ToRegex) and exists($doc//mei:manifestation//mei:item)) (: mei4+ for prints :) }; (:~ From a8c0994f1f26ff81ea16a655f56f6969a0174809 Mon Sep 17 00:00:00 2001 From: "Benjamin W. Bohl" Date: Thu, 8 Feb 2024 11:45:24 +0100 Subject: [PATCH 2/2] Update add/data/xqm/source.xqm Co-authored-by: Dennis Ried --- add/data/xqm/source.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 102694db3..812eb1920 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -44,7 +44,7 @@ import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util :) declare function source:isSource($uri as xs:string) as xs:boolean { let $doc := eutil:getDoc($uri) - let $meiVersion4To5Regex := '^[4-5](\.\d)+(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' + let $meiVersion4To5Regex := '^[4-5](\.\d){1,2}(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' (: 2010-05 pre camelCase :) (: 2011-05 2012 :) (: 2013 +meiversion.num 2.1.1:)