Schematron 2
Closed this issue · 17 comments
@ebeshero @spadafour @RJP43
I just wanted to make sure that you all are going to try to complete Schematron Exercise 2. Then you can all let @brookestewart and I what you think! Thanks!
@nlottig94 @brookestewart I'm working on it now, making some small edits so far...
@nlottig94 @brookestewart This is very ambitious, and I'm not sure our students will be ready for it right after Schematron 1. Compare your Schematron 2 with the Schematron 2 you had to do last semester and you'll see my point. I'm not sure what to do with it except to treat it as a Schematron 3 and consider rearranging the schedule. But there are some things we can do to streamline the assignment.
-
The TEI-All Relax NG schema that you are working with will ensure that every rdg element has an app parent, so there is no need to write a Schematron rule for this. (Really, a Relax NG schema will handle the rules for document hierarchy and nesting, so I don't think it's a good idea to duplicate those rules in Schematron.)
-
Why do you need to tell people in assignment 2 how to write assert and report statements? They'll have already written Schematron Exercise 1 and read about this in the tutorial. It's too much text.
-
Controlling for @wit is a good thing to do, and so is checking for the appropriate order of the poems. Is it necessary to do both kinds of tasks with variables? Typically we write variables when we have multiple assert or report statements that are going to invoke them, or when we have to point to another file. (We really will have to use a variable to point to your listWit file, but is it necessary to make one for your counting stuff and adding stuff? Can't we just do that in an assert or report test?)
- Once you show someone how to write a variable, you may want to leave it up to them to decide whether they want to keep using it, so they really think about what it is for. You want to leave some things up to the students to think through for themselves.
- You may want to explain to the students what it is they must look for to isolate a number that identifies a poem. Explain that it's a string and they need to convert it to a number using number(). Give them the problem to solve of how to figure out whether the next poem in the series has the correct number on it.* Less might be more here.
- There is a lot here that simply tells students what to do without their understanding or having to figure out why they are doing it. I understand why you wrote it that way: you're guiding students through complicated things like tokenizing on white space, using "satisfies" syntax, etc., but when they don't know necessarily why they are tokenizing on white space, they'll simply do what you say without thinking...follow orders. And that's not really our goal with these assignments. It's okay to write an exercise designed to teach a new trick (like our format-date() in XPath 4), but you want to combine it with something they're already familiar with.
You figured out and learned a great deal for yourselves and the Dickinson project in preparing this, and it's great work! But I'm not sure our new students are quite ready for this, and I think we may want to spend a little time introducing the concept of a list of witnesses or a list of ids before we dive into this. in other words, maybe this needs to come later than just now...
Compare what you've put together with where you were last year at this time: The exercise we used was: http://dh.obdurodon.org/schematron-class-02.html
I'm thinking a comparable level of difficulty here, before people have gotten very far on their projects yet, is simply to check if the poems are in the correct order and to ensure the <rdg>
elements have @wit attributes. I like the idea of showing them what a list of witnesses is for, but I think we need to introduce the handling of that stuff in a separate file later! We could introduce them to tokenizing on white space and matching to a list of witnesses in the same file, and then point them elsewhere for a little advanced tutorial with more information and examples when they're ready...but I'm not sure our new students will be learning as much as you learned from this when they attempt the assignment next week. There's too much new material here in one homework assignment!
@brookestewart @nlottig94 I don't know if we can revise this in time to use it, but if you'd like to try revising your assignment to respond to my critique here, I'd need it by Saturday.
@RJP43 @ebeshero @spadafour Here is the newest version of Schematron 2! Let @brookestewart and I know what you think!
@nlottig94 @brookestewart @RJP43 @spadafour It's much better--I think this is about right for where our new students are right now--and I like how you're showing them a new string function this time!
I think we can convert your other material that you had to cut into a project-oriented tutorial on testing and checking ids (and it's good we can view the full history of the assignment here in GitHub because we can refer back to your work when we're ready to make that tutorial). For right now, this seems just right for our assignment--and I'll work on some edits for Monday. Thank you for your speedy work!!
@nlottig94 @brookestewart I'm actually adding back your xml:id checking rules, but I'm putting your listWit up in the TEI header all in the same file: I'd like to explain how xml:id checking basically works in a project in class tomorrow and then just give the syntax to students as a gift with the assignment plus an accompanying mini-tutorial--it'll definitely help with projects. But the actual homework assignment will be the prompts you prepared based on counts and checking sequence, etc.
Okay, schematron 2 isn't that bad, but I'm stuck on one tiny detail at the end: I need to add, and I can't seem to do it. So --for the last part of the homework-- this is what I have so far:
<pattern>
<rule context="tei:div[@type='poem' and preceding-sibling::tei:div[@type='poem']]">
<assert test=".//tei:title/text()/number(substring(., 6, 2)) = ./preceding-sibling::tei:div[@type='poem']//tei:title/text()/number(substring(., 6, 2))">how do I add one to the final part of this test???</assert>
</rule>
</pattern>
Basically, I'm equating the poem number to the previous poem number. I need to make it say poem number = previous poem number + 1... but I have no idea how. I tried tacking it on with a literal + sign.
= ./preceding-sibling::tei:div[@type='poem']//tei:title/text()/number(substring(., 6, 2)) + 1"
That doesn't work. It gives me this error:
A sequence of more than one item is not allowed as the first operand of '+' (1, 2)
This gives me a red squiggly:
= ./preceding-sibling::tei:div[@type='poem']//tei:title/text()/number((substring(., 6, 2)) + 1)"
I also tried the sum() function:
= sum(./preceding-sibling::tei:div[@type='poem']//tei:title/text()/number(substring(., 6, 2)), 1)
And that nets me a sum of ALL previous, so that isn't what I'm looking for.
So how the heck can I just tack a 1 on?!
@spadafour Here's a hint: You want to see if the number from the first preceding-sibling:: + 1 equals the number at the current context. Schematron will rightly get bent out of shape at trying to look at all the preceding siblings. So to get the first preceding sibling, you grab it by its position in relation to the current context...A number inside a predicate will do...
...also, I'm adding a slightly challenging and interesting application of matches() to this assignment to test for white space or lack thereof around app tags... I'll post a new version in a bit.
Ah, such an easy fix! Thank you.
Also, do you want me to submit this at all? I can if you open a link in course web.
@spadafour Hold off about 30 minutes and look in at GitHub again. I'm rewriting the last part of it now--there was some old material confusing things in it...and there'll be a thorny new challenge to look at...
@spadafour @nlottig94 @brookestewart @RJP43 Please have a look at Schematron Exercise 2 now. I've added one more task, and I've simplified the instructions in the sequential ordering of poems. Rob, if you could specifically look at the new third Schematron task, testing for white spaces, I'd appreciate it.
So, @spadafour @nlottig94 @brookestewart @RJP43 be sure to pull from the repository, or access the new version by refreshing your browser here: http://htmlpreview.github.io/?https://github.com/ebeshero/newtFire-webDev/blob/master/dh-courses-Common/SchematronExercise2.html
Did you also change the dickinsonFullWithErrors.xml file, or is it still the same?
@spadafour I changed it just a bit, but likely not enough to affect your results. I was fussing with the white space for task 3, not the poem order.
I'm having a really hard time understanding how to deal with capturing lines that end in a quotation mark. If I'm writing literal regex to find a line ending in a space, dash, or quotation, I would write:
[— "]$
But when I'm using matches() and inserting that into a schematron rule, the " symbol screws the whole rule up. Using the escaped form "
doesn't help because inside of the brackets, I'd be catching &, q, u, o, t, and ; instead of the literal symbol. And I can't say "?$
because that isn't what I'm looking for.
Am I completely off track, or is there something I'm not thinking about?
@spadafour You're not off track--that's a tough and weird little challenge. We should probably make it a bonus. The problem is, you can't put a literal quotation mark in the square brackets of a character set in matches() because it's taken as the end of the schematron predicate, and as you saw the escaped character can't go inside the character set either because it's a literal string of characters in that space. The solution is to put "
outside the character set with a pipe...