Skip to content

Instantly share code, notes, and snippets.

@jimmyli97
Created June 11, 2015 14:41
Show Gist options
  • Save jimmyli97/ef561d714a98a058b7a4 to your computer and use it in GitHub Desktop.
Save jimmyli97/ef561d714a98a058b7a4 to your computer and use it in GitHub Desktop.
example for formula ID ambiguity
<mws:expr url="math.3.0">
<math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.1.m1" class="ltx_Math" alttext="{\displaystyle a}" display="inline" xml:id="p1.1.m1.1" xref="p1.1.m1.1.cmml">
<semantics xml:id="p1.1.m1.1a" xref="p1.1.m1.1.cmml">
<mi xml:id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">a</mi>
<annotation-xml encoding="MathML-Content" xml:id="p1.1.m1.1.cmml" xref="p1.1.m1.1">
<ci xml:id="p1.1.m1.1.1.cmml" xref="p1.1.m1.1.1">a</ci>
</annotation-xml>
<annotation encoding="application/x-tex" xml:id="p1.1.m1.1b" xref="p1.1.m1.1.cmml">{\displaystyle a}</annotation>
</semantics>
</math>
</mws:expr>
<mws:expr url="math.4.0">
<math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.1.m1" class="ltx_Math" alttext="{\displaystyle{{\bar{\alpha}}(\theta_{i})}}" display="inline" xml:id="p1.1.m1.1" xref="p1.1.m1.1.cmml">
<semantics xml:id="p1.1.m1.1a" xref="p1.1.m1.1.cmml">
<mrow xml:id="p1.1.m1.1.6" xref="p1.1.m1.1.6.cmml">
<mover accent="true" xml:id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">
<mi xml:id="p1.1.m1.1.1.2" xref="p1.1.m1.1.1.2.cmml">α</mi>
<mo stretchy="false" xml:id="p1.1.m1.1.1.1" xref="p1.1.m1.1.1.1.cmml">¯</mo>
</mover>
<mo xml:id="p1.1.m1.1.6.1" xref="p1.1.m1.1.6.1.cmml">⁢</mo>
<mrow xml:id="p1.1.m1.1.6.2" xref="p1.1.m1.1.6.2.cmml">
<mo xml:id="p1.1.m1.1.6.2a" xref="p1.1.m1.1.6.2.cmml">(</mo>
<msub xml:id="p1.1.m1.1.6.2b" xref="p1.1.m1.1.6.2.cmml">
<mi xml:id="p1.1.m1.1.3" xref="p1.1.m1.1.3.cmml">θ</mi>
<mi xml:id="p1.1.m1.1.4.1" xref="p1.1.m1.1.4.1.cmml">i</mi>
</msub>
<mo xml:id="p1.1.m1.1.6.2c" xref="p1.1.m1.1.6.2.cmml">)</mo>
</mrow>
</mrow>
<annotation-xml encoding="MathML-Content" xml:id="p1.1.m1.1.cmml" xref="p1.1.m1.1">
<apply xml:id="p1.1.m1.1.6.cmml" xref="p1.1.m1.1.6">
<times xml:id="p1.1.m1.1.6.1.cmml" xref="p1.1.m1.1.6.1"/>
<apply xml:id="p1.1.m1.1.1.cmml" xref="p1.1.m1.1.1">
<ci xml:id="p1.1.m1.1.1.1.cmml" xref="p1.1.m1.1.1.1">normal-¯</ci>
<ci xml:id="p1.1.m1.1.1.2.cmml" xref="p1.1.m1.1.1.2">α</ci>
</apply>
<apply xml:id="p1.1.m1.1.6.2.cmml" xref="p1.1.m1.1.6.2">
<csymbol cd="ambiguous" xml:id="p1.1.m1.1.6.2.1.cmml">subscript</csymbol>
<ci xml:id="p1.1.m1.1.3.cmml" xref="p1.1.m1.1.3">θ</ci>
<ci xml:id="p1.1.m1.1.4.1.cmml" xref="p1.1.m1.1.4.1">i</ci>
</apply>
</apply>
</annotation-xml>
<annotation encoding="application/x-tex" xml:id="p1.1.m1.1b" xref="p1.1.m1.1.cmml">{\displaystyle{{\bar{\alpha}}(\theta_{i})}}</annotation>
</semantics>
</math>
</mws:expr>
@jimmyli97
Copy link
Author

So if the XQuery returns an xref of "math_subset.xml#p1.1.m1.1.1.cmml", then there exists ambiguity between whether it refers to math.4.0 or math.3.0

@physikerwelt
Copy link

that's right
but how do you derive this math_subset.xml#p1.1.m1.1.1.cmml what's the query?

@jimmyli97
Copy link
Author

I don't think the query is relevant to my question, only the result of the query - the NTCIR format says that you return results in the following format:

<hit id="id" xref=""filename" score="score" rank="rank">
  <formula id="id" for="idref" xref="fref" score="score">
    <qvar for="name" xref="sub-fref"/>
    <qvar/>
  </formula>
</hit>

Where "for" attributes specify the query ID, and "xref" attributes specify the formula ID in the result.
NTCIR format states that the <formula> xref attribute is of form "filename#id", where ID is the formula ID.

So my question is, if the formula ID is "p1.1.m1.1.1.cmml", how do you specify which result it is using the NTCIR format? Do you use something like "filename#math.3.0#p1.1.m1.1.1.cmml"?

@physikerwelt
Copy link

I think filename is the url. You are mixing the mws dump format with the NTCIR dump format here.

@physikerwelt
Copy link

Probably you mix the formats since I mixed them

@physikerwelt
Copy link

let me see if I can find the NTCIR dump format spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment