| Did you know ... | Search Documentation: |
| Packs (add-ons) for SWI-Prolog |
| Title: | Compile an RDFS schema to prolog predicates |
|---|---|
| Rating: | Not rated. Create the first rating! |
| Latest version: | 0.0.5 |
| SHA1 sum: | 2581484754c34cde348802a5d4b82987c6d06993 |
| Author: | Chris Mungall <cmungall@gmail.com> |
| Home page: | https://github.com/cmungall/rdfs2pl |
| Download URL: | https://github.com/cmungall/rdfs2pl.git |
No reviews. Create the first review!.
| Version | SHA1 | #Downloads | URL |
|---|---|---|---|
| 0.0.5 | 2581484754c34cde348802a5d4b82987c6d06993 | 37 | https://github.com/cmungall/rdfs2pl/archive/v0.0.5.zip |
| 0.0.3 | 07d146bebabe992b923a555e6fab7be59c3ffa7d | 19 | https://github.com/samer--/rdfs2pl.git |
| 0.0.2 | ae7a2db571c4ab782b4bf6b5aea33219e73a8337 | 2 | https://github.com/cmungall/rdfs2pl.git |
| 0.0.1 | 947c6c7c2711bde2a966b5b3cc82756aef5b7b41 | 1 | https://github.com/cmungall/rdfs2pl.git |
Given an ontology pizza.owl:
:- ensure_loaded( library(rdfs2pl) ).
:- use_module(library(semweb/rdf_db)).
gen :-
rdf_load('pizza.owl'),
tell('pizza.pl'),
write_schema(pizza,'http://owl.cs.manchester.ac.uk/2009/07/sssw/pizza#',[use_labels(true)]),
told.
Alternatively, use the command line wrapper:
rdfs2pl pizza pizza.owl -o pizza.pl
Compiles an RDFS schema to prolog program consisting of convenience wrapper predicates:
For example, if the ontology contains
:hasTopping a owl:ObjectProperty ;
rdfs:label "has topping" .
Then the generated module will contain
:- rdf_meta has_topping(r,r). :- op(300,xfy,has_topping/2). has_topping(X,Y) :- rdf_has(X,pizza:hasTopping,Y).
This allows convenient querying of the form:
write_pizza_toppings :-
pizza(P),
P has_topping T,
writeln(P-T),
fail.
Additional arguments are provided where we want to determine the named graph a triple is asserted in, or inspect the reification of the statement/axiom. Note OWL uses a different reification vocabulary than RDF.
where G` is the graph S-P-O is asserted in where N` is the node of the reified statement where N` is the node of the reified statement where A` is the node of the axiom reified using the owl vocabularyThese are on by default. These can be controlled via Opts in write_schema/3, or by command line options.
?- pack_install(rdfs2pl).
rdfs2pl pizza pizza.owl -o pizza.pl
For all options, see
rdfs2pl -h
Source code available and pull requests accepted at http://github.com/cmungall/rdfs2pl
Pack contains 6 files holding a total of 612K bytes.