Wednesday, 2 December 2009

SPARQL - extension




I know that there is a working group that is looking for extending the current SPARQL specification/protocol. There are also some discussions outside the working group that outlines requirements for such an extension.

As a contribution to these efforts, in this post I want to start outlining things ( queries ) that are not possible to write using SPARQL in its current state. Requirement of such query syntax and support stems from demands of practical Semantic Web development work. Here are some examples. I will appreciate your comments if I am incorrectly assuming that these sort of queries are not possible to write.

1. A query to verify the cardinality of property values.
For example, in DBPedia, a Band (<http://dbpedia.org/ontology/Band>) has property <http://dbpedia.org/ontology/genre> with no cardinality restrictions (i.e. Band can have any number of genres).

Using sparql one can not extract Bands which has more than x number of genres?

The following SPARQL query is not possible to write and execute:

Select ?band
where
{
?band rdf:type <http://dbpedia.org/ontology/Band> .
FILTER (COUNT(?genre) > 3).
}

2. Support for negation. It is well known that SPARQL does not support negation. It is obvious that negation is an important feature to have, I will demonstrate the usefulness of negation using one scenario.

In DBPedia ontology, the classification hierarchy for "Organisation" is as follows:


If you are mapping your ontology to DBPedia's and if you have a slightly different hierarchy where "SportsTeam" is not a subclass of "Organisation" then
in order to retrieve all the instances of Organisation class that are not "SportsTeam" you will need to use negation (ALL(Organisation)-ALL(SportsTeam)).

The alternative is cumbersome solution where the query will involve retrieving instances of "Organisation"subclasses except SportsTeam and then merging them. For example,

Regex support in CONSTRUCT queries:

One of the purposes of CONSTRUCT queries is to map ontologies and datasets. It will be quite useful to be able to specify regex based URI patterns as part of the CONSTRUCT queries. Particularly applicable where one wants to use the unique & human readbale identifiers from DBPedia. For example, it will be useful to have something like:

CONSTRUCT
{
<http://myurischeme/resource/"unique id from DBPedia URI"> rdf:type myOntology:myType.
}
WHERE
{
<http://dbpedia.org/resource/ABC> rdf:type <http://dbpedia.org/ontology/Person>
}

Friday, 17 July 2009

JAPE grammar tutorial

We are pleased to share the JAPE grammar tutorial we have designed here at Press Association Images, UK. The tutorial can be accessed by clicking here. It is a Zip file including tutorial in PDF formant and few support files.

Please send your comments through this blog...

Tuesday, 7 July 2009

Converting from one version of semantic data to another (.N3, N-Triples, RDF/XML, OWL)

I have found a very useful little tool that allows converting data (schema/instaces) to and from .N3, N-Triples, RDF/XML and OWL. This utility is particularly handy when your RDF stores accepts schemas in particular format only (in majority of cases N3/N-Triples). Here is the link to the tool and syntax which allows you to do so ( It took me sometime to find the exact syntax so I hope it will save some of your time).

http://www.w3.org/2000/10/swap/doc/cwm.html
&
http://infomesh.net/2001/cwm/

syntax to convert from RDF/OWL to N3.

python cwm.py --rdf file-to-be-converted.owl --n3 > file-as-output.n3


or even better....
you can use Protege :)
Open .owl file in protege and go to File -> SaveAs and save it as .N3 or turtle. So easy, isnt it?

Thursday, 18 June 2009

Ontology mapping using SPARQL (Triples extraction from DBPedia)

I have been using SPARQL CONSTRUCT for ontology mapping. One of the problems, I have encountered during my work is, how do I get around BNode in the output graph, as BNode are ugly, not shareable (if thats right word!) and you can say not at all useful here. What you want in the target graph is a clear URI, as you might want to share this new URI with other graphs you extract from different source ontologies.

I stumbled on this post, which have similar conclusion. Somewhere in the post the author mentions that,

"it appears to be impossible to create new URIs for the resources in the target ontology - only bnodes can be created on the fly."

and they had to use some post-processing script to manage bnodes. I am still working on finding a workaround, if I can not then I will have to conclude the same.

Based on my findings, I will update this post soon....

Thursday, 8 January 2009

OWL benchmarks

There is a great deal of confusion about the tools to realize semantic web applications. This confusion stems from the fact that there are a large number of tools available and the benchmarks that compare these tools are quite diverse.

For the purpose of the clarity, I will summarize these tools and benchmarks here. I intend to comment on them as much as I can during next few weeks.

(As of January 2008)

OWL reasoners: ( for reasoning, inferencing)
  1. Pellet - free/open source with some restriction on commercial use - Supports OWL DL, DL Safe SWRL rules.
    Java based
  2. RacerPro - Educational free evaluation licence, commercial paid licence - Supports OWL DL
    Java based
  3. KAON2 - Free for educational and non-academic use, different licence for commercial use. Supports OWL-DL and SWRL with F-Logic ontologies
    Java based
  4. FaCT++ - seems free,open source
    C++ based
  5. OWL API - free, open source. This is actually OWL API with reasoner interface to FaCT++ and Pellet.
    Java based
  6. OWLIM - free version with limitations, commercial licence is with all features
    Supports RDFS and most of OWL-Lite. More importantly contains a semantic repository over Sesame.
    Java based
RDF Stores (for storing RDF triples)
  1. Virtuso from OpenLink
    Getting started link is here
  2. AllegroGraph from Franz Inc.
    Java/Lisp based
    Java learning centre is here
  3. Mulgara (previously Kowari)
  4. SwiftOWLIM and BigOWLIM from ontotext
    SwiftOWLIM is an open-source library, under LGPL
    BigOWLIM is available under an RDBMS-like commercial licence on a per-server-CPU basis
  5. Sesame RDF store from Aduna
  6. Oracle 11g has RDF store support
  7. Scalable Ontology Repository (SOR) [Previously Minerva] from IBM. It supports DLP (Description Logic Program), a subset of OWL DL.
    Part of the IBM Integrated Ontology Development Toolkit.
  8. D2RServer is a a tool for serving Linked Data views on relational databases.D2R server relies on a declarative mapping between the schemata of the database and the target RDF terms. Based on this mapping, D2R Server serves a Linked Data view on your database and provides a SPARQL endpoint for the database.
Bechmarks to evaluate these reasoners/storage systems:
  1. Lehigh University Benchmark (LUBM)

    Y. Guo, Z. Pan, and J. Heflin. LUBM: A Benchmark for OWL Knowledge Base Systems. Journal of Web Semantics 3(2), 2005, pp158-182.


    One of the early works on the subject, however now seems outdated. Good reference point for any future comparisons.

    Compares the RDF stores.
    timeline: 2004/2005

  2. Berlin bechmark
    from Freie Universität, Berlin
    Benchmark for comparing the performance of storage systems that expose SPARQL endpoints ( does not compare the reasoning capacity)
    timeline: 2008

  3. University Ontology Benchmark (UOBM) from IBM

    Li Ma, Yang Yang, Zhaoming Qiu, GuoTong Xie, Yue Pan, Shengping Liu. Towards a Complete OWL Ontology Benchmark. In Proceedings of ESWC'2006. pp.125~139

    Compares the RDF stores along with its reasoning capability (OWL DL and OWL Lite).
    timeline:2006

  4. Survey paper : What's wrong with OWL Benchmarks?
    Finds (rightly) fault with above (1 and 3) benchmarks and outlines the requirements that if implemented in a benchmark shall ideally cover real world scenarios.


    This list is no way near exhaustive, so I plan to extend it whenever I can. Please drop comments if you have any...
Ta..

First post

Welcome to my Blog!