Syntax Highlighting for Common Works Registration Format

HDR12345678993MUSIC METADATA                               01.102021100405342420211004               2.2002DMP.MATIJAKOLARIC.COM         22.1 EXOFILE (OPEN SOURCE)    
GRHNWR0000102.200000000000  
NWR0000000000000000EMMA'S COUNTDOWN                                              MK000006    00000000            UNC000000YORI                                                   N00000000000                                                   N
SPU000000000000000101MK       MUSIC METADATA                               E 00000000012345678993052050000441000010000 N 
SPT0000000000000002MK        050001000010000I2136N001
SWR0000000000000003W000003  JANSEN                                       EMMA                          C 00000000000000000395023050000000000000 N  
SWT0000000000000004W000003  050000000000000I2136N001
PWR0000000000000005MK       MUSIC METADATA                               W000003  01
ALT0000000000000006EMMA'S COUNTDOWN BED                                        AT  
PER0000000000000007JANSEN                                       EMMA           
REC000000000000000820211001000000     EMMA'S COUNTDOWN                                            EMMA'S COUNTDOWN BED                                        EMMA JANSEN                                                 EMMA JANSEN RECS                                                                MK000006R     
REC000000000000000920211001000000     EMMA'S COUNTDOWN                                                                                                        EMMA JANSEN                                                 EMMA JANSEN RECS                                                                MK000005R     
ORN0000000000000010LIBEMA 001        0000EMALIB                                                                                                                                                                            0000                                                                                      
GRT000010000000100000013   0000000000
TRL000010000000100000015

This article is about reasons for using syntax highlighter for CWR files in various situations. You may have seen it on this website and in our tools. And, pretty much nowhere else.

Why is CWR Syntax Highlighting Important?

To a software developer, the question seems equivalent to: Why is walking important? We could just be crawling. But, music publishing professionals may require an explanation.

Programmers have been using syntax highlighting for decades, as visual aids to navigate quickly through a lot of text. This applies to code, but also various data formats, including CSV, JSON and XML. Once you are used to it, finding any piece of information in a large fine is much simpler.

CWR was not meant for humans to read. That is theory. In practice, you need to do it from time to time, usually when there is a problem. Some problems are technical, but with good software, you don't get many of those, if any. The rest are problems with actual data, most notably conflicts. If there is a registration conflict between you and another publisher, the two of you have to figure it out, and the CWR acknowledgement usually holds most of the answers. If you can read them. Here is the gist of it.

Data Structure

All records (rows) are not equal. They actually form a structure. File has groups of transactions. Every transaction is visually separated. In our example, each transaction starts with a red record type, in this example NWR, then publisher data (SPU/SPT) is green, writer data (SWR/SWT/PWR) is blue, etc.

Sequences and Blanks

Each transaction record has at least 2 sequence numbers, and some have more. These may be important when debugging. For most people, they are not.

There is one exception, though. The publisher chain sequence. It is, in the last example, marked with red. This is because it is important in CWR 2.2 and 3.X. They represent the link between writers and their original publishers.

If a field does not have a value, it is either blank or filled with zeros for numeric, date, time and duration fields. Such values are shown as light grey, to differentiate between fields with values and those without.

So, with light grey, we remove a lot of clutter. Now the real work begins. Colour-coding the important fields.

Which Fields are Important?

The answer really depends on the user and the use case, but after years of experimenting, we find that the example above works best for most people.

Titles

Titles, including work titles, alternative titles and record titles, are in red. Titles are always important, particularly the work title when one searches through the large file.

Publishers

General data about publishers is green, but we have to mark a separation between fields somehow, so we use red for chain sequence and role.

Writers

Very similar to publishers, marked with blue. Please note that writer-related data includes PWR records that, among other data, includes internal IP codes for the writer (blue) and the publisher (green). In 2.2 and beyond, it also includes publisher chain sequence, which is then in red, to match the colour used in SPU records. (See CWR Versions for comparison.)

Recordings and artists

Recording and artist data uses a lot of cyan.

Shares and Society Affiliations

There are three types of collectable shares and affiliations: performance, mechanical and synchronization, depicted in three different colours. Territory data is in green.

For both fields, having additional data on mouseover is important. This is not shown in the screenshot, but you can easily test it with CWR Tools.

Implementing CWR Syntax Highlighting

I truly believe that CWR syntax highlighting must be implemented in any software creating or importing CWR. And, there is no good excuse not to do it. Syntax highlighting on this website was done with open-source code from DMP.