run.bat file on Windows, and sh
run.sh command from terminal on Linux/Mac).
Book and Writer, an
object property, e.g., writtenBy, and two data properties,
e.g., bookTitle and personName.
On Mac or Linux:
$ ./h2.shOn Windows:
h2.batA window will popup from the Web browser. You can login as follows:

books database is as follows:


ontop Mappings and ontop SPARQL in the
menu Window -> Tabs -> .. ontop Mappings tab and add a new data source by
pressing the button Create New ...
jdbc:h2:tcp://localhost/./../data/bookssatestorg.h2.Driver
NOTE: If you installed your own database
server, create a books database and populate it using the SQL
scripts
from here.
Refer
to this
page for more information on how to configure a data source (you will
need a different Connection URL and a different Driver
class for database systems different from Postgres).
Mapping manager tab, select the datasource you
added, and create the following mapping:
:book{bk_code} a :Book ; :bookTitle {bk_title}^^xsd:string . SELECT "bk_code", "bk_title" FROM "tb_books" 
: denotes the default prefix (the URI of your
ontology), a is a predefined alias for the
predicate rdf:type, Book is a concept name in our
ontology (hence :Book is the URI of that concept). The
triple :book{bk_code} a :Book asserts that the individuals
identified by the string :book{bk_code} are instances of the
concept Book. Moreover, :bookTitle is a data
property in our ontology. More information about the mapping syntax can be
found here.
ontop SPARQL
tab, create a new query and call it Booktitles. In the Query
Editor field write the query:
PREFIX : <http://www.example.org/books#>
SELECT * WHERE {?book a :Book; :bookTitle ?title}
Then click on Save Changes, select the Quest reasoner and
start it. Finally, execute your query. The result should look as follows:

Attach Prefixes.