Skip to content

Commit

Permalink
Checked if the OWL verbalizer works with Yap (v5.3.1). Everything in …
Browse files Browse the repository at this point in the history
…module axiom_sentencelist and the modules that it imports seemed to work provided that the following rewriting is done:

* between/3 -> length/2
* list_to_set/2 -> sort/2

Didn't actually do these rewritings for the following (minor) reasons:

* length is slower than between
* sort changes the order with respect to list_to_set
  • Loading branch information
Kaljurand committed Jun 15, 2011
1 parent a98dee4 commit 810087a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
20 changes: 16 additions & 4 deletions owlace_dcg.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
%

owl_ace(OWL, ACE) :-
ip(OWL, ACE, []),
phrase(ip(OWL), ACE),
!.


Expand Down Expand Up @@ -307,13 +307,13 @@
[exactly, 1].
det_obj(num=pl, R, C, 'ObjectMinCardinality'(Integer, R, C)) -->
[at, least, Integer],
{ between(2, infinite, Integer) }.
{ at_least_2(Integer) }.
det_obj(num=pl, R, C, 'ObjectMaxCardinality'(Integer, R, C)) -->
[at, most, Integer],
{ between(2, infinite, Integer) }.
{ at_least_2(Integer) }.
det_obj(num=pl, R, C, 'ObjectExactCardinality'(Integer, R, C)) -->
[exactly, Integer],
{ between(2, infinite, Integer) }.
{ at_least_2(Integer) }.

auxc(num=sg, C, C) -->
[is].
Expand Down Expand Up @@ -448,3 +448,15 @@
property_verb('ObjectProperty'(R), VerbChainTail, [a, thing, that, tv_sg(R) | VerbChainTail]).

property_verb('ObjectInverseOf'('ObjectProperty'(R)), VerbChainTail, [a, thing, that, is, tv_vbg(R), by | VerbChainTail]).


%% at_least_2(?Integer:integer)
%
% Generates integers that are larger than 1.
%
at_least_2(Integer) :-
between(2, infinite, Integer).

% length/2 can be used in Prologs which do not provide between/3 (with infinite)
%at_least_2(Integer) :-
% length([_,_|_], Integer).
24 changes: 16 additions & 8 deletions table_1.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
/** <module> Table 1
@author Kaarel Kaljurand
@version 2011-06-11
@version 2011-06-15
@license LGPLv3
@tbd Handle inv(inv(...))
@tbd Handle different orderings of arguments in some axioms,
e.g. ClassAssertion, Domain, Range, property assertions
@tbd Apply list_to_set/2 where appropriate
@tbd Check the cases where a set/list must have more than 1 element according to the spec
*/

Expand All @@ -38,13 +37,13 @@
% while preserving their meaning. For example
%
%==
% EquivalentClasses'(['Class'('http://www.w3.org/2002/07/owl#Thing'), C])
% 'EquivalentClasses'(['Class'('http://www.w3.org/2002/07/owl#Thing'), C])
%==
%
% is rewritten into
%
%==
% SubClassOf'('Class'('http://www.w3.org/2002/07/owl#Thing'), C)
% 'SubClassOf'('Class'('http://www.w3.org/2002/07/owl#Thing'), C)
%==
%
% Note that sometimes we need to make several axioms from one,
Expand Down Expand Up @@ -295,14 +294,23 @@
% @param AxiomWithSet is the given axiom with its argument list converted into set
%
axiom_with_list_to_axiom_with_set('EquivalentClasses'(ClassList), 'EquivalentClasses'(ClassSet)) :-
list_to_set(ClassList, ClassSet).
remove_duplicates(ClassList, ClassSet).

axiom_with_list_to_axiom_with_set('SameIndividual'(IndividualList), 'SameIndividual'(IndividualSet)) :-
list_to_set(IndividualList, IndividualSet).
remove_duplicates(IndividualList, IndividualSet).

axiom_with_list_to_axiom_with_set('DifferentIndividuals'(IndividualList), 'DifferentIndividuals'(IndividualSet)) :-
list_to_set(IndividualList, IndividualSet).
remove_duplicates(IndividualList, IndividualSet).

% @deprecated: use: SameIndividual
axiom_with_list_to_axiom_with_set('SameIndividuals'(IndividualList), 'SameIndividual'(IndividualSet)) :-
list_to_set(IndividualList, IndividualSet).
remove_duplicates(IndividualList, IndividualSet).


remove_duplicates(List1, List2) :-
list_to_set(List1, List2).

% sort/2 can be used in Prologs which do not have list_to_set/2.
% This is semantically correct, although it does have an effect on the test cases.
%remove_duplicates(List1, List2) :-
% sort(List1, List2).
3 changes: 3 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ python run_tests.py -i ontologies/ -m $mode -f csv -p
python run_tests.py -i examples/ -m $mode -p
python run_tests.py -i examples/ -m $mode -f csv -p
hg st


#time ./owl_to_ace.exe -xml ontologies/galen/full-galen.owl2xml.owl -format csv > /dev/null

0 comments on commit 810087a

Please sign in to comment.