Skip to content

Commit

Permalink
Updated the readme with the new name for ql:has-relation
Browse files Browse the repository at this point in the history
Also fixed the e2e tests.
  • Loading branch information
floriankramer committed Jul 29, 2018
1 parent 0fd9d0b commit 584806a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Status](https://travis-ci.org/ad-freiburg/QLever.svg?branch=master)](https://travis-ci.org/ad-freiburg/QLever)

QLever (pronounced "clever") is a query engine for efficient combined search on a knowledge base and a text corpus, in which named entities from the knowledge base have been identified.
The query language is SPARQL extended by three QLever-specific predicates `ql:contains-entity`, `ql:contains-word` and `ql:has-relation`. `ql:contains-entity` and `ql:contains-word` can express the occurrence of an entity or word (the object of the predicate) in a text record (the subject of the predicate). `ql:has-relation` can be used to efficiently count available predicates for a set of entities.
The query language is SPARQL extended by three QLever-specific predicates `ql:contains-entity`, `ql:contains-word` and `ql:has-predicate`. `ql:contains-entity` and `ql:contains-word` can express the occurrence of an entity or word (the object of the predicate) in a text record (the subject of the predicate). `ql:has-predicate` can be used to efficiently count available predicates for a set of entities.
Pure SPARQL is supported as well.

With this, it is possible to answer queries like the following one for astronauts who walked on the moon:
Expand Down Expand Up @@ -202,7 +202,7 @@ If you want support for SPARQL queries with predicate variables (perfectly norm

./IndexBuilderMain -i /path/to/myindex -n /path/to/input.nt -a -w

To generate a patterns file and include support for ql:has-relations:
To generate a patterns file and include support for ql:has-predicates:

./IndexBuilderMain -i /path/to/myindex -n /path/to/input.nt --patterns

Expand Down Expand Up @@ -347,19 +347,18 @@ Text / Knowledge-base data can be nested in queries. This allows queries like on
For now, each text-record variable is required to have a triple `ql:contains-word/entity WORD/URI`.
Pure connections to variables (e.g. "Books with a description that mentions a plant.") are planned for the future.

To obtain a list of available relations and their counts `ql:has-relation` can be used if the index was build with the `--patterns` option, and the server was started with the `--patterns` option:
To obtain a list of available predicates and their counts `ql:has-predicate` can be used if the index was build with the `--patterns` option, and the server was started with the `--patterns` option:

SELECT ?relations (COUNT(?relations) as ?count) WHERE {
?s <is-a> <Scientist> .
?t2 ql:contains-entity ?s .
?t2 ql:contains-word "manhattan project" .
?s ql:has-relation ?relations .
?s ql:has-predicate ?relations .
}
GROUP BY ?relations
ORDER BY DESC(?count)

As of yet using ql:has-relation in any other form of query (apart from adding more triples in the WHERE part) ist not supported.
In particular ql:has-relation can not be used as a normal predicate to add all available relations to the current solution.
`ql:has-predicate` can also be used as a normal predicate in an arbitrary query.

Group by is supported, but aggregate aliases may currently only be used within the SELECT part of the query:

Expand Down
22 changes: 11 additions & 11 deletions e2e/scientists_queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,34 +85,34 @@ queries:
solutions:
- type: no-text
sparql: |
SELECT ?place ?count WHERE {
SELECT ?place (COUNT(?x) as ?count2) WHERE {
?x <is-a> <Scientist> .
?x <Place_of_birth> ?place .
}
GROUP BY ?place
ORDER BY DESC((COUNT(?x) as ?count))
checks:
- num_cols: 1
- num_rows: 1
- selected: ["?place"]
- order_numeric: {"dir": "DESC", "var": "?count"}
- num_cols: 2
# The query returns to many rows, the current limit is 4096
# - num_rows: 5295
- selected: ["?place", "?count2"]
- order_numeric: {"dir": "DESC", "var": "?count2"}
- query: scientists-order-by-aggregate-avg
solutions:
- type: no-text
sparql: |
SELECT ?profession ?avg WHERE {
SELECT ?profession (AVG(?height) as ?avg2) WHERE {
?x <is-a> <Scientist> .
?x <Profession> ?profession .
?x <Height> ?height .
}
GROUP BY ?profession
ORDER BY ASC((AVG(?height) as ?avg))
LIMIT 1
checks:
- num_cols: 1
- num_rows: 1
- selected: ["?profession"]
- order_numeric: {"dir": "ASC", "var": "?count"}
- num_cols: 2
- num_rows: 209
- selected: ["?profession", "?avg2"]
- order_numeric: {"dir": "ASC", "var": "?avg2"}
- query: group-by-profession-average-height
solutions:
- type: no-text
Expand Down

0 comments on commit 584806a

Please sign in to comment.