Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for ql:has-relation. Fixes #64 #65

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion 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 two QLever-specific predicates `ql:contains-entity` and `ql:contains-word`, which can express the occurrence of an entity or word (the object of the predicate) in a text record (the subject of the predicate).
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.
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 @@ -118,6 +118,10 @@ 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:

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

If you want some literals to be written to an on disk vocabulary (by default this concerns literals longer than 50 chars and literals in less frequent lagnuages), add an topional parameter -l. This is useful for large knowledge bases that included texts (descriptions etc) as literals and thus consume lots of memory on startup without this option.

./IndexBuilderMain -i /path/to/myindex -n /path/to/input.nt -l
Expand Down Expand Up @@ -261,7 +265,19 @@ 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:

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 .
}
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.

# How to obtain data to play around with

Expand Down