BPL 3.2 Released

Hello.

This is just for informing that the new release of:

Bousi~Prolog version 3.2

https://dectau.uclm.es/bousi-prolog

has been launched on April, 6th, 2019, and tested for:

SWI-Prolog 7.6.4 running on:

Ubuntu 18 LTS,
CentOS 7.6-1810,
Windows 10, and
macOS High Sierra

Bousi~Prolog (BPL) is a fuzzy logic programming language that replaces the syntactic unification mechanism of classical SLD-resolution by a fuzzy unification algorithm. This algorithm provides a weak most general unifier as well as a numerical value, called the unification degree. Intuitively, the unification degree represents the truth degree associated with the (query) computed instance. Then, the core of BPL operational semantics is a fuzzy unification algorithm based on proximity relations (that is a reflexive and symmetric, but not necessarily transitive, binary fuzzy relation on a set). Hence generalizing the operational mechanism of [Se2006], based on similarity relations, and increasing the expressive power of the resulting language. Proximity relations allow us to model problems where the transitivity restriction of a similarity relation is an obstacle.

In addition to proximity relations, BPL provides directives for defining fuzzy subsets, which give semantics to linguistic terms and are a valuable resource for modeling vagueness. Recently, a connection to the WordNet lexical database has been developed.

The current version has reached a new degree of maturity. The system is more stable and a number of small errors have been fixed. However, the main novelty of this version has been the incorporation of filtering techniques that optimize the TPL code generated after the parsing phase. Also, fuzzy modifiers can be applied on predicate symbols.

Executables and installers for different OS’s can be downloaded from:

https://dectau.uclm.es/bousi-prolog/downloads/

Also, an on-line (prototype) system is also available at:

https://dectau.uclm.es/bplweb/

Best regards.

Pascual Julián-Iranzo and Fernando Sáenz-Pérez

References:

[JR2015] Pascual Julián-Iranzo and Clemente Rubio-Manzano (2015). “Proximity-based unification theory”. Fuzzy Sets Syst. 262, C (March 2015), 21-43.

[JR2017] Pascual Julián Iranzo and Clemente Rubio-Manzano (2017). “A sound and complete semantics for a similarity-based logic programming language”. Fuzzy Sets and Systems 317:1-26.

[JS2018] Pascual Julián-Iranzo and Fernando Sáenz-Pérez (2018). “An Efficient Proximity-based Unification Algorithm”. 2018 IEEE International Conference on Fuzzy Systems.

[JS2019] Pascual Julián-Iranzo and Fernando Sáenz-Pérez (2019). “WordNet Measures of Lexical Semantic Relatedness in a Fuzzy Logic Programming System”. [Submitted]

[RJ2014] Clemente Rubio-Manzano and Pascual Julián-Iranzo (2014). “A Fuzzy linguistic Prolog and its applications”. Journal of Intelligent and Fuzzy Systems 26(3): 1503-1516.

[Se2002] Maria I. Sessa, “Approximate reasoning by similarity-based SLD resolution”, Theoretical Computer Science, vol. 275, no. 1-2, pp. 389–426, 2002.

2 Likes

Thank so much, dears !

I’m on the way to enable SWISH hosting for BPL.
So, I have ‘packed’ your source, cause I think would smooth the path, so far I got:

carlo@carlo-ubuntu-1604:~$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.5-1-g8ea8d6a)
<snip>
?- pack_install('file:///home/carlo/develop/bousi_pack',[upgrade(true)]).
% gcc -c -fPIC -pthread -I"/home/carlo/lib/swipl/include" -obuild/closure.o extern/closure.c
<snip>
% gcc -c -fPIC -pthread -I"/home/carlo/lib/swipl/include" -obuild/install.o extern/install.c
% swipl-ld -shared -fPIC -L/home/carlo/lib/swipl/lib/x86_64-linux -lswipl -o external.so build/closure.o build/blocks.o build/fuzzysets.o build/array.o build/lexical.o build/tokenize.o build/shell.o build/install.o
% make: Nothing to be done for 'check'.
% cp external.so /home/carlo/lib/swipl/lib/x86_64-linux
true.

?- [library(bousi_pack)].
Warning: /home/carlo/lib/swipl/pack/bousi_pack/prolog/source/evaluator.pl:1442:
Warning:    Invalid mode declaration in PlDoc comment: sim(?('Sym1'),?('Sym2'),?('Degree'))is(dynamic)
<snip>
Warning:    Invalid mode declaration in PlDoc comment: failed_tests(?('Number'))is(dynamic)
true.

?- 

Example run:

?- [library(bousi_pack)].
true.

?- bousi_pack.

                                                    Universidad de
|O)               |D)                            Castilla - La Mancha
|O)(O)\U(S)|I| ~~ || |R (O) |L (O) (G|.     (Version 3.2 ~~ April 2019)
----------------------------------------------------------------------------
Welcome to Bousi~Prolog, a fuzzy logic programming system created by
Juan Gallardo-Casero and Pascual Julian-Iranzo. Fernando Saenz-Perez

<snip>
BPL> ts
Testing...

------------------------------------------------------------------------------
Running Bousi-Prolog shell tests
------------------------------------------------------------------------------
Testing command ''... OK
Testing command '  '... OK
...

etc etc

I have simplified a lot the external loader. Now it just reference the shared lib that pack_install build.
If you agree, I can publish the draft on github, named bousi_pack.

Other than applied NLP (semantic publishing, in WordPress), I’m interested in visual programming, do you think bousi could help to smoothly render large predicate collections in 2D coding, with semantic attributes like colouring and sizing resulting by tags aggregation?

OT: have been a lot of years that I had not the pleasure to code for a Prolog extension, and have been the first time I approached docker. Very nice! I was at wits end to boot SWISH by source. The bower impasse made me unable to get a localhost SWISH. Had some not funny hours…then I tried for the first time the docker approach. Learned how to install and start, and now it’s running!

$ docker pull swipl/swish
...
$ docker run -it -p 3050:3050 swipl/swish

the -it (interactive) get back SwiPl prompt. Great!

A question… How to get a working pkg-config?

ifeq ($(CFLAGS),)
#seems pack_install does not get PKG_CONFIG_PATH ?
#CFLAGS =  -c -fPIC `pkg-config --cflags swipl` 
 CXFLAGS =  -c -fPIC -I$(HOME)/lib/swipl/include
else
 CXFLAGS =  -c $(CFLAGS)
endif

Dear Carlo.

Thank you very much for the interest you have in BPL. We (Fernando and me) greatly appreciate your help to make BPL visible.

Regarding to your questions:

  1. “If you agree, I can publish the draft on github, named bousi_pack.”

Of course you can, thank you very much. We are glad for this. Specifically, I am impressed by your ability to build this package. Certainly I have to learn a lot.

  1. "Other than applied NLP (semantic publishing, in WordPress), I’m interested in visual programming, do you think it could help to smoothly render large collections in 2D coding, with semantic attributes like coloring and sizing resulting from aggregation ? "

We are not experts in that field. Nevertheless, since BPL works on SWI-Prolog, it should work with those collections, although we have not done tests.

  1. “A question … How to get a working pkg-config?”

We do not know what to answer to this question. Sorry for that. We shall think a better answer.

Best regards.
Pascual and Fernando.

For swipl? The normal installation process on Unix installs $prefix/share/pkgconfig/swipl.pc. For package installation though you do not need that. pack_install/1 passes a number of environment variables to the build process that allows for simple abstract Makefiles:

  • PACKSODIR contains the directory where you should put the shared object
  • SOEXT has the extension for shared objects for this platform
  • LDSOFLAGS provides the C flags to create a compatible shared object
  • SWISOLIB links to libswipl.so/dll/… if this is needed (notably ELF platforms do not
    need this).

Here is a simple example:

SOBJ=   $(PACKSODIR)/geoip4pl.$(SOEXT)

all:    $(SOBJ)

OBJ=    c/geoip4pl.o

$(SOBJ): $(OBJ)
        mkdir -p $(PACKSODIR)
        $(LD) $(LDSOFLAGS) -o $@ $(OBJ) $(SWISOLIB) -lGeoIP

check::
install::
clean:
        rm -f $(OBJ)
distclean: clean
        rm -f $(SOBJ)

For debugging purposes pack_install creates a shell script in the build location that sets the same variables, so you can run the compiler from any environment.

Thanks, Jan, great insight !

A very draft pack_install(able) is here.

I’m not sure how much effort still is needed to run flawless in dockerized SWISH.
Could be easy if docker could be made to share host’ network interface.

About the source, I left out a license file, since have not found so far appropriate terms in sources.

CIao, Carlo

That’s great, Carlo! I think Pascual will provide license details.

Hi Sirs,

I got no luck while installing the pack.   Below is the error massage:

Do you know what the wrong is? Thanks for your helps in advance. John

"
?- pack_install(bousi_pack).
% Contacting server at …www.swi-prolog.org/pack/query … ok
Install bousi_pack@1.0.0 from GIT at …github.com/CapelliC/bousi_pack.git Y/n?

Create directory for packages
(1) * c:/users/jlin13/appdata/roaming/swi-prolog/pack
(2) c:/program files (x86)/swipl/pack
(3) Cancel

Your choice?
ERROR: source_sink `path(git)’ does not exist
ERROR: In:
ERROR: [21] throw(error(existence_error(source_sink,…),_11486))
ERROR: [17] process:process_create(path(git),[clone,'https://github.com/CapelliC/bousi_pack.git’|…],[stdout(…),…|…]) at c:/program files (x86)/swipl/library/process.pl:254
ERROR: [16]
ERROR: [15] ‘$sig_atomic’(prolog_pack:process_create(…,…,…))
ERROR: [14] setup_call_catcher_cleanup(prolog_pack:process_create(…,…,…),prolog_pack:(…,…),_11648,prolog_pack:(…,…)) at c:/program files (x86)/swipl/boot/init.pl:469
ERROR: [12] prolog_pack:run_process(path(git),[clone,'https://github.com/CapelliC/bousi_pack.git’|…],[]) at c:/program files (x86)/swipl/library/prolog_pack.pl:2174

ERROR: [11]
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
"

You need the git program installed and in %PATH%. You’ll probably also need MinGW to get a C compiler and various dependencies. I don’t know how easy that will be on Windows, but the developers can possibly be of help

1 Like

Hi.

While the technical problems are solved, if what you want is to try with the BPL language, you can click on:

https://dectau.uclm.es:8443

Best Regards.
P.

Hi Jan,

Thanks you for your helps. Yes, I tried to install git and MinGW and finally it worked on SWISH. Can I use it directly inside SWI-prolog with module(library(bousi_pack)) declaration? Could you please give an example how to include it in SWI Prolog programming?

Also, can I use command line to run bousi.exe, just like swipl.exe to run prolog program? for example “% swipl -g go -g halt”.

Thanks again for your supper helps. :slight_smile:

With respect to your second question, there is no provision for command-line arguments in bousi.exe. We’ll try to support them for the next system release. However, you can redirect the contents of a file to bousi.exe. For example, in Windows:

type file | bousi

You can include in file all the inputs you need (as ld, qt, and goals).

Hi John

really ? would be great… maybe you meant SWIPL ?
Once fulfilled prerequisites Jan explained, from swipl indeed you should be able to

:- pack_install(bousi_pack).