README.md in arx-0.3.2 vs README.md in arx-1.0.0
- old
+ new
@@ -22,10 +22,27 @@
Although [Scholastica](https://github.com/scholastica) offer a great [Ruby gem](https://github.com/scholastica/arxiv) for retrieving papers from arXiv through the search API, this gem is only intended for retrieving one paper at a time, and only supports searching for paper by ID.
*Arx is a gem that allows for quick and easy querying of the arXiv search API, without having to worry about manually writing your own search query strings or parse the resulting XML query response to find the data you need.*
+## Example
+
+Suppose we wish to search for:
+
+> Papers in the `cs.FL` (Formal Languages and Automata Theory) category whose title contains `"Buchi Automata"`, not authored by `Tomáš Babiak`, sorted by submission date (latest first).
+
+This query can be executed with the following code:
+
+```ruby
+require 'arx'
+
+papers = Arx(sort_by: :date_submitted) do |query|
+ query.category('cs.FL')
+ query.title('Buchi Automata').and_not.author('Tomáš Babiak')
+end
+```
+
## Features
- Ruby classes `Arx::Paper`, `Arx::Author` and `Arx::Category` that wrap the resulting Atom XML query result from the search API.
- Supports querying by a paper's ID, title, author(s), abstract, subject category, comment, journal reference, or report number.
- Provides a small embedded DSL for writing queries.
@@ -176,17 +193,17 @@
q = Arx::Query.new
q.author('Dominik Edelmann')
q.category('math.NA')
```
-To change the logical connective used to chain subqueries, use the `&()` (and), `|()` (or) and `!()` (and not) instance methods between the subquery calls:
+To change the logical connective used to chain subqueries, use the `and`, `or`, `and_not` instance methods between the subquery calls:
```ruby
# Papers authored by "Eleonora Andreotti" in neither the "Numerical Analysis" (math.NA) or "Combinatorics (math.CO)" categories.
q = Arx::Query.new
q.author('Eleonora Andreotti')
-q.!()
+q.and_not
q.category('math.NA', 'math.CO', connective: :or)
```
### Running search queries
@@ -200,13 +217,11 @@
```ruby
# Papers in the cs.FL category whose title contains "Buchi Automata", not authored by Tomáš Babiak
results = Arx(sort_by: :date_submitted) do |query|
query.category('cs.FL')
- query.title('Buchi Automata')
- query.!()
- query.author('Tomáš Babiak')
+ query.title('Buchi Automata').and_not.author('Tomáš Babiak')
end
results.size #=> 18
```
@@ -218,13 +233,11 @@
```ruby
# Papers in the cs.FL category whose title contains "Buchi Automata", not authored by Tomáš Babiak
q = Arx::Query.new(sort_by: :date_submitted)
q.category('cs.FL')
-q.title('Buchi Automata')
-q.!()
-q.author('Tomáš Babiak')
+q.title('Buchi Automata').and_not.author('Tomáš Babiak')
results = Arx(query: q)
results.size #=> 18
```
@@ -257,13 +270,22 @@
```ruby
paper = Arx('1809.09415')
#=> #<Arx::Paper:0x00007fb657b59bd0>
paper.id
+#=> "1809.09415"
+paper.id(version: true)
#=> "1809.09415v1"
paper.url
+#=> "http://arxiv.org/abs/1809.09415"
+paper.url(version: true)
#=> "http://arxiv.org/abs/1809.09415v1"
+paper.version
+#=> 1
+paper.revision?
+#=> false
+
paper.title
#=> "On finitely ambiguous Büchi automata"
paper.summary
#=> "Unambiguous B\\\"uchi automata, i.e. B\\\"uchi automata allowing..."
paper.authors
@@ -278,11 +300,9 @@
# Dates
paper.published_at
#=> #<DateTime: 2018-09-25T11:40:39+00:00 ((2458387j,42039s,0n),+0s,2299161j)>
paper.updated_at
#=> #<DateTime: 2018-09-25T11:40:39+00:00 ((2458387j,42039s,0n),+0s,2299161j)>
-paper.revision?
-#=> false
# Paper's comment
paper.comment?
#=> false
paper.comment
\ No newline at end of file