Custom TOM MARC Expression Language Examples

Starting with Polaris 8.1, customers can now add Custom TOMs to Polaris, using a new MARC Expression Language (MEL). We’ve been testing the new TOMs, so I wanted to share what we’ve implemented so far in the hopes that this gives others a helpful starting point.

These examples are based on our cataloging practices and might need to be adjusted depending on your local systems.

Please update the post or reply with your own examples, improvements, or other approaches.


Playaway

Based on OLAC Best Practices

LDR/06 = i (Nonmusical sound recording)
006/00 = m (Computer file)
006/06 = q (Direct electronic)
006/09 = h (Sound)

AND DOES NOT CONTAIN:
006/00 = a (Language Material)

MEL:
(LDR/06 = 'i' and (ANY 006 WHERE (_ matches /^m.{5}q.{2}h/i)) and not (006/00 = 'a'))

SQL (to check bibs that match)

SELECT DISTINCT BR.BibliographicRecordID
FROM Polaris.BibliographicRecords BR
WHERE BR.RecordStatusID = 1
	AND BR.MARCBibType = 'i'
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT006
	JOIN Polaris.BibliographicSubfields BS006
		ON BT006.BibliographicTagID = BS006.BibliographicTagID
	WHERE BT006.BibliographicRecordID = BR.BibliographicRecordID
		AND BT006.TagNumber = 6
		AND LEFT(BS006.Data,10) LIKE 'm_____q__h'
)
AND NOT EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT006
	JOIN Polaris.BibliographicSubfields BS006
		ON BT006.BibliographicTagID = BS006.BibliographicTagID
	WHERE BT006.BibliographicRecordID = BR.BibliographicRecordID
		AND BT006.TagNumber = 6
		AND LEFT(BS006.Data,1) = 'a'

)

Read Along Book

Examples: VoxBook / WonderBook.
Based on OLAC Best Practices)

(Two 006s Needed)
LDR/06 = i (Nonmusical sound recording)
006/00 = m (Computer file)
006/06 = q (Direct electronic)
006/09 = h (Sound)

006/00 = a (Language Material)

MEL:
(LDR/06 = 'i' and (ANY 006 WHERE (_ matches /^m.{5}q.{2}h/i)) and (006/00 = 'a'))

SQL (to check bibs that match)

SELECT DISTINCT BR.BibliographicRecordID
FROM Polaris.BibliographicRecords BR
WHERE BR.RecordStatusID = 1
	AND BR.MARCBibType = 'i'
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT006
	JOIN Polaris.BibliographicSubfields BS006
		ON BT006.BibliographicTagID = BS006.BibliographicTagID
	WHERE BT006.BibliographicRecordID = BR.BibliographicRecordID
		AND BT006.TagNumber = 6
		AND LEFT(BS006.Data,10) LIKE 'm_____q__h'
)
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT006
	JOIN Polaris.BibliographicSubfields BS006
		ON BT006.BibliographicTagID = BS006.BibliographicTagID
	WHERE BT006.BibliographicRecordID = BR.BibliographicRecordID
		AND BT006.TagNumber = 6
		AND LEFT(BS006.Data,1) = 'a'

)

Board Book

340$l board book binding

MEL:
340$l matches /board( |-)book|boardbook binding/i

SQL (to check bibs that match):

SELECT DISTINCT BR.BibliographicRecordID
FROM Polaris.BibliographicRecords BR
JOIN Polaris.BibliographicTags BT340
  ON BR.BibliographicRecordID = BT340.BibliographicRecordID
 AND BT340.TagNumber = 340
JOIN Polaris.BibliographicSubfields BS340
  ON BT340.BibliographicTagID = BS340.BibliographicTagID
  AND BS340.Subfield = 'l'
WHERE BR.RecordStatusID = 1
  AND BS340.Data LIKE 'Board%Book%Binding'

Playaway Launchpad

LDR/06 - m (computer file)
007/00 - c (electronic resource)
007/01 - s (standalone device)
007/03 - c (multicolored)

MEL:
LDR/06 = 'm' and 007/00 = 'c' and 007/01 = 's' and 007/03 = 'c'

SQL (to check bibs that match)

SELECT DISTINCT BR.BibliographicRecordID
FROM Polaris.BibliographicRecords BR
WHERE BR.RecordStatusID = 1
AND BR.MARCBibType = 'm'
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT007a
	JOIN Polaris.BibliographicSubfields BS007a
		ON BT007a.BibliographicTagID = BS007a.BibliographicTagID
	WHERE BT007a.BibliographicRecordID = BR.BibliographicRecordID
		AND BT007a.TagNumber = 7
		AND SUBSTRING(BS007a.Data,1,1) = 'c'
		AND SUBSTRING(BS007a.Data,2,1) = 's'
		AND SUBSTRING(BS007a.Data,4,1) = 'c'
)

WhaZoodle

Pre-loaded media player, like a playaway for kids.

LDR/06 - m (Computer file)
007/00 - c (Electronic resource)
007/01 - z (Other)
007/00 - s (Sound recording)
007/01 - z (Other)
008/23 - q (Direct electronic)
008/26 - h (Sound)

MEL:
LDR/06 = 'm' and ANY 007 WHERE (_ matches /^cz/i) and ANY 007 WHERE (_ matches /^sz/i) and 008/23 = 'q' and 008/26 = 'h'

SQL (to check bibs that match)


SELECT DISTINCT BR.BibliographicRecordID
FROM Polaris.BibliographicRecords BR
JOIN Polaris.BibliographicTags BT008
  ON BR.BibliographicRecordID = BT008.BibliographicRecordID
 AND BT008.TagNumber = 008
JOIN Polaris.BibliographicSubfields BS008
  ON BT008.BibliographicTagID = BS008.BibliographicTagID
WHERE BR.RecordStatusID = 1
	AND BR.MARCBibType = 'm'
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT007a
	JOIN Polaris.BibliographicSubfields BS007a
		ON BT007a.BibliographicTagID = BS007a.BibliographicTagID
	WHERE BT007a.BibliographicRecordID = BR.BibliographicRecordID
		AND BT007a.TagNumber = 007
		AND LEFT(BS007a.Data,2) = 'cz'
)
AND EXISTS (
	SELECT 1
	FROM Polaris.BibliographicTags BT007b
	JOIN Polaris.BibliographicSubfields BS007b
		ON BT007b.BibliographicTagID = BS007b.BibliographicTagID
	WHERE BT007b.BibliographicRecordID = BR.BibliographicRecordID
		AND BT007b.TagNumber = 007
		AND LEFT(BS007b.Data,2) = 'sz'
)
  AND SUBSTRING(BS008.Data,24,1) = 'q'
  AND SUBSTRING(BS008.Data,27,1) = 'h'


Book (modified)

Added “not 006/00 = m” to existing Book TOM to remove electronic items.

((LDR/06 in ['a','t'] and not (LDR/07 in ['b','i','s'])) or (006/00 in ['a','t']) or (007/00 = 't')) and not (006/00 in ['m'])

7 Likes

This is great Matt. Thank you for sharing. We upgrade tomorrow so it will be nice to have a starting point for some of the ones we know we want to add.

Thanks for sharing! We’ve been looking forward to this feature. I was kicking around adding a graphic novel TOM since so many children’s titles have been adapted lately. Could be helpful?

1 Like

Hi Bethany! I created a Graphic Novel TOM and tested it on our training server. It’s working well for us so far. We go live with 8.1 next week.

Graphic Novel

LDR/06 = ‘a’ and 008/24 = ‘6’

2 Likes

Hi Elaine,

We’re looking at possibly creating a custom TOM for graphic novels as well, and realized that we have some records with ‘6’ in 008/25-27 in addition to 008/24 (for titles that have a bibliography as well as being a graphic novel, etc).

Do you have any records like that, and if so, how are you handling those?

Hi Lisa-

You’re correct that the “6” can be anywhere in the 008 positions 24-27 (and apparently also possible in the 006).

I’m not aware of a better way to handle this, so I’m thinking we’ll need a bunch of OR’s. I haven’t tested this, but I think it should look like this:

LDR/06 = 'a' and ((006/07 = '6') or (006/08 = '6') or (006/09 = '6') or (006/10 = '6') or (008/24 = '6') or (008/25 = '6') or (008/26 = '6') or (008/27 = '6'))

Thanks, that’s very helpful!

I’m wondering if something like this might work also: LDR/06 = ‘a’ and ANY 008 WHERE (_ matches /^.{24,27}6/)

but I’m not sure I have the syntax quite right or if ANY WHERE can be used with 008.

This is great news, thanks Elaine!

Hi all - we are working our way through the custom TOM process, and the predicate text that we’ve come up with is coming up as invalid. Is there anyone feeling comfortable with this who would be willing to have a look at it to let me know what we are doing wrong and where we should go from here? If not I’ll submit a ticket to Innovative to have someone there walk me through it. Thanks!

No harm in posting it here and having folks take a look and see if something jumps out.

Okay, here goes! I’m attaching my document here. Column G is the predicate text we are using - I had one of my catalogers look at the samples that I found on here and Polaris Help, and she amended them based on our cataloging practices. I’ve tried inputting all the video game platforms and the graphic novels and they all came up as invalid.

Custom TOMs.xlsx (23.6 KB)

Hi Kristine-

Thanks for the examples! It looks like it’s an issue with the syntax of the MARC tags. Here’s a bit from Clarivate’s documentation:

Data field references (DataRef)

The grammar includes a production to reference MARC data fields and their subfields. A data field reference is written as a three-digit tag immediately followed by a dollar sign ($) and a subfield code. The subfield code may be a lowercase letter (a z) or a digit (0 9).

Data field references behave the same as other FieldRef productions: they may be used in comparisons (=, ==, in, cin), regex matches expressions, quantified ANY/ALL WHERE clauses, and in COUNT expressions where appropriate. Case-sensitivity and membership semantics described below apply to comparisons against data field values.

Examples:

  • 753$a = 'wii'

  • 753$a matches /.wii./i

Using one of your video game examples, the 347 tag can either be:

and (347$b = 'Xbox one.'))

or

and (347$b matches /.Xbox one./i))

That syntax should fix it, but if you’re still having issues, let us know.

1 Like

Thanks Matt! That’s still not working for me. I made the change you suggested, which didn’t work. We then looked at a record and compared it to the predicate text, and made another change that we thought might be needed, and that didn’t work either. Thoughts? If someone had time to hop on a call for me to share my screens I can do that, or I can just submit a ticket to Innovative to see if there’s someone there who can walk me through it!

Sorry that it’s still not working. I’d be happy to jump on a call, but before we do that, I wanted to check a few things:

  1. Did you let the overnight job run? Changes to the tables in PolarisAdmin won’t be reflected until the next day.
  2. Is the new TOM high up in the Order of Precedence table?
  3. Can you share the MEL that you used and a link to a PAC record that you expect to match?

Thanks

1 Like

Thanks Matt!

  1. I did let the overnight job run each time.
  2. Yes - I put it in spot 2 right under 4K Blu-ray.
  3. Here is the MELimageand a link: https://trac.ca.iiivega.com/search/card?recordId=1797328

Thank you!

Kristine

It is a bit difficult to determine if Vega is showing “the real” MARC record, but if it is…

006 m     q  g    

There appear to be TWO spaces between q..g

What I’m seeing in what you pasted would require NO spaces between qg: ANY 006 WHERE (_ matches /^m.{5}qg/i)

Maybe this would work? ANY 006 WHERE (_ matches /^m.{5}q.{2}g/i)it should allow for ANYthing (including a space) between the q & g.

Thank you Wes! I’m learning so much about this - I was struggling with even understanding the MEL and how it worked, so all of this is clarifying things for me. I’ve put that in to allow for those spaces and will see if that changes things when I look at them tomorrow. I really appreciate everyone’s help! :crossed_fingers:

The good news is that because regular expressions are not library specific there are lots of tools that you could use to help.

For example: https://regex101.com/

Here is a sample of what the data entry could look like:

Thanks Wes. That fix you suggested doesn’t seem to have worked, so I’ll give that tool a try in a few weeks when I’m back from vacation. Much appreciated!

I hope the vacation is a good one. If you post any sample raw MARC data here as well, we can continue to help with sleuthing. Seems like we can’t trust what we’re seeing out of the Vega MARC view.

1 Like