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

Package the APE modules as a SWI-Prolog extension package #4

Open
Kaljurand opened this issue May 13, 2012 · 6 comments
Open

Package the APE modules as a SWI-Prolog extension package #4

Kaljurand opened this issue May 13, 2012 · 6 comments

Comments

@Kaljurand
Copy link
Member

See more: http://www.swi-prolog.org/howto/Pack.html

@whitten
Copy link

whitten commented May 14, 2016

What happened with this?
Did the APE modules get packaged as SWI-Prolog extensions 4 years ago?

@tkuhn
Copy link
Member

tkuhn commented May 14, 2016

I don't think this has ever happened, which is also why this issue is still open...

@Kaljurand
Copy link
Member Author

To my knowledge nobody has worked on this issue.

Kaljurand added a commit that referenced this issue Jul 14, 2018
Create SWI-Prolog pack (solves #4)
@Kaljurand
Copy link
Member Author

APE can now be installed via SWI-Prolog's package manager, but some improvements would be needed:

  • the official package list (http://www.swi-prolog.org/pack/list) does not contain an entry for "APE". The entry for "ape" represents an older experimental package from https://github.com/fnogatz/APE
  • pack_install('APE') does not work (but pack_install('https://github.com/Attempto/APE.git') does)
  • not sure how to use the installed pack as a module, using assert(user:file_search_path(pack, '/home/kaarel/lib/swipl/pack/APE/prolog/')) worked (see below), but there should be a better way

Keeping this issue open until these things are resolved. Also, the README should still be updated to document the new way of installation.

@tkuhn and @fnogatz, any ideas?

$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.4)
...

?- pack_list_installed.
% There are no extra packages installed.
% Please visit http://www.swi-prolog.org/pack/list.
true.

?- pack_install('APE').
% Contacting server at http://www.swi-prolog.org/pack/query ... done
Warning: No registered pack matches "APE"
false.

?- pack_install('https://github.com/Attempto/APE.git').

Create directory for packages
   (1) * /home/kaarel/lib/swipl/pack
   (2)   Cancel

Your choice? 
% Cloning into '/home/kaarel/lib/swipl/pack/APE'...
Verify package status (anonymously)
	at "http://www.swi-prolog.org/pack/query" Y/n? 
% Contacting server at http://www.swi-prolog.org/pack/query ... ok
% "APE.git" was downloaded 1 times
Package:                APE
Title:                  Parser for Attempto Controlled English (ACE)
Installed version:      6.7.180715
Author:                 Kaarel Kaljurand <kaljurand@gmail.com>, Norbert E. Fuchs <fuchs@ifi.uzh.ch>, Tobias Kuhn <kuhntobias@gmail.com>
Home page:              https://github.com/Attempto/APE
Download URL:           https://github.com/Attempto/APE/releases/*.zip
Run post installation scripts for pack "APE" Y/n? 
% Targets:
% 
%   build: builds ape.exe
%     doc: generates documentation
%   clean: deletes automatically generatable files
%    test: runs some tests
% 
% make: Nothing to be done for 'check'.
% swipl -O -F none -g "working_directory(_, 'prolog/parser'), [fit_to_plp], halt." -t halt ; swipl -O -f ape.pl -g "qsave_program('ape.exe', [goal(ape), toplevel(halt)])." -t halt
% Reading "sorts.fit"
% Reading "grammar.fit"
% [...]
% % Autoloader: iteration 1 resolved 14 predicates and loaded 114 files in 0.449 seconds.  Restarting ...
% % Autoloader: loaded 14 files in 2 iterations in 0.571 seconds
true.

?- pack_list_installed.
Installed packages (1):

i APE@6.7.180715            - Parser for Attempto Controlled English (ACE)
true.

?- assert(user:file_search_path(pack, '/home/kaarel/lib/swipl/pack/APE/prolog/')).
true.

?- use_module(pack(ape)).
Warning: /home/kaarel/lib/swipl/pack/APE/prolog/utils/drs_to_html.pl:38:
	Deprecated declaration has no effect: style_check(atom)
true.

?- get_ape_results([text='John waits.', solo=drs], ContentType, Content).
ContentType = 'text/plain',
Content = 'drs([A],[predicate(A,wait,named(\'John\'))-1/2])'.

?- halt.

$ $HOME/lib/swipl/pack/APE/ape.exe -text 'John waits.' -solo drs
drs([A],[predicate(A,wait,named('John'))-1/2])

@fnogatz
Copy link
Contributor

fnogatz commented Jul 25, 2018

Answering the questions by @Kaljurand in #4 (comment):

the official package list (http://www.swi-prolog.org/pack/list) does not contain an entry for "APE".

According to SWI-Prolog's documentation package names should be all lowercase letters:

name(Pack)
Name of the pack. This must be provided. Must consists of ASCII characters that can always appear in filenames. Due to case (in) sensitivity characters, use lowercase letters. Use _ as word separator.

Even if it might be possible, I would not recommend using uppercase letters. There is currently not a single package name that has an uppercase letter, and calls like use_module(library('APE')) are simply not usual in SWI.

The entry for "ape" represents an older experimental package from https://github.com/fnogatz/APE

SWI-Prolog does not check the package's owner. So it might be possible to easily reclaim the ape name by just installing from this repository.

not sure how to use the installed pack as a module

After a successful installation this should simply work by calling use_module(library(ape)). In library(race) I just loaded the module and made us of your tokenizer module.

@JohnAZoidberg
Copy link

It would be cool to have a new version released.
On GitHub and on SWI.

Many changes have been made since 2013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants