Debian Codegraph @

docs/html/refparsing.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>Biblio::Citation::Parser 1.10 Documentation - Reference Parsing</title>
5 <link rel="stylesheet" href="epdocs.css" type="text/css" />
6 <link rev="made" href="mailto:[email protected]" />
7 </head>
8
9 <body>
10 <table border="0" width="100%" cellspacing="0" cellpadding="3">
11 <tr><td class="block" valign="middle">
12 <big><strong><span class="block">&nbsp;Biblio::Citation::Parser 1.10 Documentation - Reference Parsing</span></strong></big>
13 </td></tr>
14 </table>
15
16 <p><a name="__index__"></a></p>
17 <!-- INDEX BEGIN -->
18
19 <ul>
20
21 <li><a href="#parsing_references">Parsing References</a></li>
22 <li><a href="#creating_an_openurl">Creating an OpenURL</a></li>
23 <li><a href="#metadata_structure">Metadata Structure</a></li>
24 </ul>
25 <!-- INDEX END -->
26
27 <hr />
28 <p>
29 </p>
30 <h1><a name="parsing_references">Parsing References</a></h1>
31 <p>Biblio::Citation::Parser is designed for parsing citations, and this can be done very simply:</p>
32 <pre>
33 use Biblio::Citation::Parser::Standard;
34 my $parser = new Biblio::Citation::Parser::Standard();
35 my $metadata = $parser-&gt;parse(&quot;Jewell, M (2002) Parsing Examples&quot;);</pre>
36 <p>The <code>$metadata</code> variable is a hash containing the information extracted from the reference.</p>
37 <p>If you'd prefer to use another parser, simply substitute the 'Standard' for the appropriate module. Biblio::Citation::Parser is distributed with the Jiao module, which is a slightly modified version of a module created by Zhuoan Jiao. To use this instead of the Standard module, you would do the following:</p>
38 <pre>
39 use Biblio::Citation::Parser::Jiao;
40 my $parser = new Biblio::Citation::Parser::Jiao();
41 my $metadata = $parser-&gt;parse(&quot;Jewell, M (2002) Parsing Examples&quot;);</pre>
42 <p>The Standard module provides slightly richer metadata than the Jiao module, but it does rely on templates (see Biblio::Citation::Parser::Templates) so requires updating as new citation formats are found.</p>
43 <p>
44 </p>
45 <hr />
46 <h1><a name="creating_an_openurl">Creating an OpenURL</a></h1>
47 <p>Once you have the metadata from the reference, it is easy to create an OpenURL from it:</p>
48 <pre>
49 use Biblio::Citation::Parser::Standard;
50 use Biblio::Citation::Parser::Utils;
51 my $parser = new Biblio::Citation::Parser::Standard();
52 my $metadata = $parser-&gt;parse(&quot;Jewell, M (2002) Parsing Examples&quot;);
53 my $openurl = create_openurl($metadata);</pre>
54 <p>The OpenURLs created by Biblio::Citation::Parser do not have a Base URL prefixed, so this should be carried out before they are used (the ParaCite base URL is <a href="http://paracite.eprints.org/cgi-bin/openurl.cgi).">http://paracite.eprints.org/cgi-bin/openurl.cgi).</a></p>
55 <p>If you would like to try to extract more information from the metadata, you can use the <code>decompose_openurl</code> function:</p>
56 <pre>
57 my ($enriched_metadata, @errors) = decompose_openurl($metadata);
58
59 This tries to extract information from SICIs, page ranges, etc, and also checks the fields for validity (the C&lt;@errors&gt; array contains any mistakes).</pre>
60 <p>Note that the create_openurl has been superceded by URI::OpenURL, but the metadata returned by <code>trim_openurl</code> is in the correct format to be passed to this module.</p>
61 <p>
62 </p>
63 <hr />
64 <h1><a name="metadata_structure">Metadata Structure</a></h1>
65 <p>Biblio::Citation::Parser supports all of the fields specified in Table 1 of the OpenURL specification (http://www.sfxit.com/openurl/openurl.html). Specific parsers can add their own fields, but these are not exported when OpenURLs are created. Biblio::Citation::Parser::Standard provides the following extra fields:</p>
66 <dl>
67 <dt><strong><a name="item_marked"><strong>marked</strong></a></strong><br />
68 </dt>
69 <dd>
70 A marked-up version of the reference. e.g. &lt;author&gt;Jewell, M&lt;/author&gt; (&lt;year&gt;2002&lt;/year&gt;) &lt;title&gt;A title&lt;/title&gt;.
71 </dd>
72 <p></p>
73 <dt><strong><a name="item_match"><strong>match</strong></a></strong><br />
74 </dt>
75 <dd>
76 The template matched by Biblio::Citation::Parser::Standard
77 </dd>
78 <p></p>
79 <dt><strong><a name="item_ref"><strong>ref</strong></a></strong><br />
80 </dt>
81 <dd>
82 The original reference
83 </dd>
84 <p></p></dl>
85 <table border="0" width="100%" cellspacing="0" cellpadding="3">
86 <tr><td class="block" valign="middle">
87 <big><strong><span class="block">&nbsp;Biblio::Citation::Parser 1.10 Documentation - Reference Parsing</span></strong></big>
88 </td></tr>
89 </table>
90
91 </body>
92
93 </html>