srophe / syriaca-data

Repository for Syriaca.org TEI data, used by srophe-eXist-app.
4 stars 16 forks source link

@srophe:tags="#syriaca-headword" can we require one with xml:lang="en" #816

Closed davidamichelson closed 4 years ago

davidamichelson commented 4 years ago

@dlschwartz Can we do either of these with a schema?

See current documentation:

@srophe:tags="#syriaca-headword"

Using a feature native to the Srophé App, Syriaca.org designates one English name and (where available) one Syriac name as preferred name forms for use in headers, alphabetizing search result lists, etc. These Syriaca.org preferred name forms are indicated by the use of a non-TEI attribute on the <placeName> element whose value is "#syriaca-headword". This attribute is attached to the namespace https://srophe.app associated with the Srophé App.

Here is an example where "Edessa" is the Syriaca.org headword for a place:

<placeName xml:id="name78-1" xml:lang="en"
    syriaca-tags="#syriaca-headword"
    source="#bib78-1 #bib78-2 #bib78-5 #bib78-6">
    Edessa
</placeName>

To facilitate sorting and browsing, the srophe:tags="#syriaca-headword" can be used only once per language (as indicated in the @xml:lang value). Accordingly, each record must have one and only one <placeName> element with the combination of @srophe:tags="#syriaca-headword" and @xml:lang="en". The use of an English headword is required, but the use of Syriac headword is only recommended because a Syriac name form may not exist for all entities (for example Nashville, TN). In addition to English and Syriac, the @srophe:tags="#syriaca-headword" may also be used to indicate preferred forms in other languages such as Arabic or French at the discretion of editors.

dlschwartz commented 4 years ago

I thought this rule was already included but it looks like it isn't. I can do that.

davidamichelson commented 4 years ago

Can you do both rules above?

dlschwartz commented 4 years ago

yep

davidamichelson commented 4 years ago

Great, please close this issue when you are done.

dlschwartz commented 4 years ago

@davidamichelson @wlpotter the commit linked above ought to do the trick. Please test and let me know if it's not working correctly.

Btw, I needed to put the error message on the <place> element rather than directly on the <placeName> element so that might not be as expected but it is intentional.

dlschwartz commented 4 years ago

The commit linked above updates the schema to fire the rule on <placeName> instead of <place> which I think is preferable.

dlschwartz commented 4 years ago

I've had to reopen this issue. The schematron rules work fine. However, the need to use namespaced attributes in the xpath of the schematron rule is creating a problem. For whatever reason, the xslt that transforms the .odd into .rng doesn't grab the namespace declaration and put it in the right place. I've got some ideas of what the problems are and I can think of at least one simple workaround. I'm going to test things a bit and think through some issues. Just know that this will work at some point.

dlschwartz commented 4 years ago

I just want to record some notes.

It looks like the way we are handling the creation of attributes in our own namespace is a bit unorthodox. I thought of this as creating something that would work like xml namespaced attributes used throughout the TEI (@xml:id, @xml:lang, etc.). As such, I created these attributes in the ODD with the desired prefix attached, i.e. with an <attDef ident="srophe:tags">. This has worked fine except that when I generate the RelaxNG out of the ODD I have to manually add xmlns:srophe="https://srophe.app" as an attribute on the root <TEI> element.

The results have been what I have wanted. When encoding, the attribute has the namespace attached, i.e. @srophe:tags. This makes it clear to anyone interested that this attribute is not in the TEI namespace and what namespace it is in. But it's streamlined which I also like.

I have also used Roma (beta) to generate a new attribute in a specified namespace. I've tried downloading ODD and generating the RelaxNG in oXygen and I've also tried downloading RelaxNG directly from Roma. I created the attribute @boo and put it into the srophe namespace. When I associate a TEI file with the resulting schema, it requires me to use two attributes, one declaring the namespace of the attribute and the other including the namespace prefix (which I don't get to choose). It would look like this: <p xmlns:sr="http://srophe.app" sr:boo="">Some text here.</p>. I'm not crazy about this as it seems clunky.

Finally, and this is where it is relevant to this issue, in neither situation can I use a namespaced attribute in a schematron rule that gets embedded into my ODD and then transformed into RelaxNG. I have tried adding @xmlns:srophe="https://srophe.app" to the <constraintSpec> and each of its children. In each case I get a error message indicating that the namespace has not been declared. I will reach out to Elisa Beshero-Bondar just to make sure but I think the solution will be to create a separate schematron file that contains these rules. That will require three schema associations in the xml declaration. One for the RelaxNG, one for the embedded schematron rules in the RelaxNG (these two are the norm), and a third for the standalone schematron file.

davidamichelson commented 4 years ago

@dlschwartz Okay, just let us know when you are done. Sorry this turned out to be complex!

dlschwartz commented 4 years ago

@davidamichelson @wlpotter this should work correctly with the three xml declaration lines Will has put into the batch change documents. Please let me know if you get anything you don't expect. If it seems to be working correctly go ahead and close this issue.

wlpotter commented 4 years ago

This is working correctly; thanks!

dlschwartz commented 4 years ago

No wonder this is so difficult to deal with: https://github.com/TEIC/TEI/issues/1837. It's a complicated problem with issues in the TEIC and with the default settings of oXygen. But, it's also difficult because some on Council don't really want to provide support for TEI customization. As a result, it is poorly documented in the guidelines.