(SURF) FURQL prototype

FURQL (FUzzy Rdf Query Language)

The FURQL language is a fuzzy extension of the SPARQL query language that makes it possible to express fuzzy preferences on the entities of an F-RDF graph (through fuzzy conditions) and on the structure of the graph (through fuzzy regular expressions). It is based on fuzzy graph pattern matching.

A fuzzy graph pattern considers the following binary operators: AND (SPARQL concatenation), UNION (SPARQL UNION), OPT (SPARQL OPTIONAL) and FILTER(SPARQL FILTER).

Syntactically, FURQL extends SPARQL by allowing the occurrence of fuzzy graph patterns in the WHERE clause and the occurrence of fuzzy conditions in the FILTER clause. A fuzzy regular expression is close to a property path, as defined in SPARQL 1.1, and may involve fuzzy structural properties (e.g. concerning the distance between two nodes or the strength of a path).

An example of a fuzzy SPARQL pattern is the following one:

?art1 (friend+ | distance is short) ?art2. ?art2 creator ?alb. ?alb rating ?rating. ?art1 recommends ?alb.

A FURQL query is composed of:

1) a list of DEFINE clauses for fuzzy term declaration. If a fuzzy term fterm corresponds to a trapezoidal function of the general form of Figure Trapezoidal function with the four positions (abscissa) A-a, A, B and B+b then the clause has the form DEFINE fterm AS (A-a,A,B,B+b). If fterm is a decreasing function like the term short of Figure Fuzzy term short then the clause has the form DEFINEDESC fterm AS (gamma,delta).
2) a SELECT clause of the form SELECT variables WHERE pattern where pattern is a fuzzy graph pattern.
3) a FILTER clause of the form FILTER conditions where conditions is the set of conditions attached to the pattern.

    Within the FURQL language, more complex fuzzy conditions may be expressed,

  • either concerning the content of nodes, the released year of an album is required to be “recent” where recent is a fuzzy term, or
  • concerning the form of a path eg. a path going from an artist to another is required to be “short” where short is a fuzzy term.
Trapezoidal function

Trapezoidal function

Fuzzy term short

Fuzzy term short

Fuzzy term recent

Fuzzy term recent

Here is shown an example of a FURQL query that aims to retrieve the artists that recommend recent albums made by close friends, and performs an alpha-cut on the answers (only those having a satisfaction degree greater or equal to 0.3 are kept). The CUT clause is of course optional.

DEFINEDASC short AS (3,5) DEFINEASC recent AS (2010,2014)
SELECT ?art1 WHERE { ?art1 recommends ?alb. ?alb date ?date. ?art1 (friend+ | distance I S short) ?art2. ?art2 creator ?alb.
FILTER (?date IS recent) } CUT 0.3

In this example, the DEFINEDESC clause of te first line defines the fuzzy term short, and the following clause defines the fuzzy term recent. The pattern in the WHERE clause is the pattern given above, for which fuzzy conditions are added: a fuzzy condition on the year of the album that has to be recent and a fuzzy condition on the length (with the fuzzy graph definition of length) of the path of the form friend+ going from an ?art1 to ?art2 that has to be short.

This prototype supports also the expression of fuzzy quantified statements of the type Q B X are A over fuzzy RDF graph databases, where the quantifier Q is represented by a fuzzy set and denotes either a relative quantifier (e.g.,most) or an absolute one (e.g.,at least three), B is the fuzzy condition “to be connected to a node x”, X is the set of nodes in the graph, and A denotes a fuzzy (possibly compound) condition.

An example of such a statement is: “most of the recent albums that are recommended by an artist, are highly rated and have been created by a young friend of this artist”.

For example, the query that aims to retrieve every artist (?art1) such that most of the recent albums(?alb) that he/she recommends are highly rated and have been created by a young friend (?art2) of his/hers may be expressedin FURQL as follows:

1 DEFINEQRELATIVEASC most AS (0,1) DEFINEASC high AS(2,5) DEFINEDESC young AS (25,40) DEFINEASC recent AS (2010,2015)
2 SELECT ?art1 WHERE { ?art1 recommends ?alb. ?alb date ?date.
3 FILTER ( ?date IS recent ) }
4 GROUP BY ?art1
5 HAVING most(?alb) ARE ( ?art1 friend ?art2. ?art2 creator ?alb. ?alb rating ?rating. ?art2 age ?age.
6 FILTER (?rating I Shigh && ?age IS young) )

where the DEFINEQRELATIVEASC clause defines the fuzzy relative increasing quantifier most, the DEFINEASC clauses define the (increasing) membership functions associated with the fuzzy terms high and recent, and the DEFINEDESC clause defines the (decreasing) membership function associated with the fuzzy term young. In this query, ?art1 corresponds to ?res, ?alb corresponds to ?X, lines 2 to 3 correspond to B and lines 5 to 6 correspond to A.

Fuzzy relative increasing quantifier most

Fuzzy relative increasing quantifier most

These type of queries can be calculated according to Zadeh’sapproach in 1983 and Yager’s OWA-based approach in 1988.

Implementation of FURQL

The evaluation strategy we propose for processing these queries consists of a software add-on layer over a standard classical SPARQL engine. We implemented the software within the Jena Semantic Web Java Framework for creating and manipulating RDF graphs. We used Vaadin, a web framework for Java under NetBeansIDE 8.2, for creating the user interface.

This software evaluates FURQL queries that contain fuzzyquantified statements whose syntax was presented above. It basically consists of two modules:

  • a pre-processing module, the query compiler, which produces i) the query dependent functions that allow us to compute muA and muB, for each returned answer, according to the chosen interpretation, ii) a (crisp) SPARQL query, which is then sent to the SPARQL query engine for retrieving the information needed to calculate μA and μB.
  • a post-processing module which calculates μA, μB and μ for each returned answer, ranks the answers, and filters them if an alpha-cut has been specified in the initial fuzzy query.

Figure FURQL architecture illustrates this architecture.

SUGAR architecture

FURQL architecture

Downloading and installing FURQL

In order to install and run locally the prototype on your computer, you need to

  • Download the archive furql_1.0.3.zip (approx. 42 MB).
  • Enter in the furql-ui folder (cd furql_1.0.3/furql-ui).
  • Cleand and Build the project with Maven (which should be previously installed on your computer) by   mvn clean install
  • Start Jetty by mvn jetty:run
  • Open the project on http://localhost:8080/

In progress …