RDF Data Cubes with ontop

78 views
Skip to first unread message

Adrian Brasoveanu

unread,
Apr 8, 2014, 6:48:55 AM4/8/14
to ontop...@googlegroups.com
Hello all,

I've produced some simple RDF Data Cubes for starters. As always there are some problems I can't quite find
in the documentation about how to make (maybe) simple things:

1) When I materialize triples from a data cube using ontop, it typically generates
the triples that would result from the mappings first then throw an error when I gets to the triples that
are already in the ontology (the error says something along the lines that those triples can't be generated from the database for some reason,
which is logic since they are not in the database, but on the other hand they should not be generated from the DB ....
as I said there are cases when you don't want to generate everything)

A quick fix for this would be to just take the generated triples and paste them at the end of the Turtle file with a simple script,
which is what I do for now.

2) There are situations when I want to generate data for multiple languages.
It so happens that I have the labels for multiple languages in the database (English, German, etc).
Do I need to write 2 separate mappings? (one for German, one for English) or is there a way to write
just one mapping and insert some logic that says the label should be in this language and from this field....

I've only seen simple mappings and don't really know if it's possible to add such conditions.
Is there a convention for publishing data in multiple languages with ontop?
It would be really good to know this convention if it exists, as it is useful for triplifications :)

3) How can I run ontop with multiple ontologies so that I can generate multiple cubes? There are 2 solutions as far as I can see, but each has its problems:

- a) either use a single ontology (as all data cubes have the same structure), but keep in mind the dsd (data structure definitions) do not come from the database -
so I will not really know which thing belongs to which cube without writing some logic to re-assemble them later....(see question 1)

- b) either use multiple ontologies - but then how do I start ontop in Virtual Graph mode with multiple ontologies (would be nice to be able to do that) ?
As far as I noticed you start ontop with an ontology that has one obda file associated.....

What would be the case to use to generate multiple data cubes (case a) or b) from this question)?

4) Suppose I just want some initials for a person : LB instead of Laurel Brown, for example....(useful if you do not want to publish the real names of the persons). 
Can we also use some functions / logic to split words, extract part of them, etc,  or some logic to reject certain types of URIs 
without writing Java code when we write ontop mappings?

Not sure if everything I said was clear, or doable with ontop. What do you think?

Other than these problems, I already like ontop (so much better than just Jena) :) Keep up the good work!

Best regards,
Adrian

Martín Rezk

unread,
Apr 8, 2014, 8:06:22 AM4/8/14
to Adrian Brasoveanu, ontop...@googlegroups.com
Hi Adrian,


> 1) When I materialize triples from a data cube using ontop, it typically
> generates
> the triples that would result from the mappings first then throw an error
> when I gets to the triples that
> are already in the ontology (the error says something along the lines that
> those triples can't be generated from the database for some reason,
> which is logic since they are not in the database, but on the other hand
> they should not be generated from the DB ....
> as I said there are cases when you don't want to generate everything)


Could you send us the mappings and the ontology so we can reproduce the error?


> 2) There are situations when I want to generate data for multiple languages.
> It so happens that I have the labels for multiple languages in the database
> (English, German, etc).
> Do I need to write 2 separate mappings? (one for German, one for English) or

If you have it in the DB, you can extract it

mappingId Book titles in Italian
source SELECT id, title, lang FROM books
target :BID_{id} :title {title}@{lang} .

Observe that you can be creative in the SQL query to get that
information from the DB. Otherwise you could do something like

target :BID_{id} :title {title}@en; :title {title2}@ge .



>
> 3) How can I run ontop with multiple ontologies so that I can generate
> multiple cubes? There are 2 solutions as far as I can see, but each has its
> problems:


Right now you can use only one ontology in ontop. What you can do is
to merge all the classes and properties into one single ontology and
give them different URI to distinguish them. You can use Protege for that.



> 4) Suppose I just want some initials for a person : LB instead of Laurel
> Brown, for example....(useful if you do not want to publish the real names
> of the persons).
> Can we also use some functions / logic to split words, extract part of them,
> etc, or some logic to reject certain types of URIs
> without writing Java code when we write ontop mappings?


Yes, you can encode that using SQL. The SQL query can massage the
string in any way you want, and return the result. Check string
manipulation in SQL.


Hope it helps.

> Other than these problems, I already like ontop (so much better than just
> Jena) :) Keep up the good work!

Thanks!

Best

Martin.-



> You received this message because you are subscribed to the Google Groups
> "ontop4obda" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ontop4obda+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

artem....@fluidops.com

unread,
Aug 5, 2014, 6:09:33 AM8/5/14
to ontop...@googlegroups.com
Hello Adrian,

Have you been able to produce some usable data cubes triples using R2RML? 
Maybe you could share problems that you've encountered and workarounds that you've applied, if any. 

Thanks,
Artem

Adrian Brasoveanu

unread,
Aug 5, 2014, 10:09:33 AM8/5/14
to ontop...@googlegroups.com
Hello Artem,

I created RDF Data Cubes with ontop, but using directly their mapping language instead of R2RML.
As they say, ontop can be used with anything that uses an ontology....

Few months ago, R2RML implementation from ontop was producing really ugly code....(extremely hard to matain),
therefore using their ontop mapping language offered a better alternative....

Now regarding their ontop mapping language: There were some problems with mapping certain
data types and also with importing ontologies, but other than was fine. Also another limitation with the ontop mapping language
was that at the time you could use only an ontology and just one OBDA and one query file... (not sure if this changed).

Luckily we had different ontologies for different data cubes, therefore this worked for us.
Another approach could be to create the triples and use dummy names and then use a bash script to rewrite those URIs that were dummy.
This would also eliminate the single ontology requirement...but of course it adds a bit of time for the extra URI rewriting involved...

I think the new version of ontop has a new R2RML writer, so I think R2RML problems might be solved...

Also the ontop team is great and they helped me a lot :)

Best regards,
Adrian

Guohui Xiao

unread,
Aug 5, 2014, 10:31:15 AM8/5/14
to Adrian Brasoveanu, ontop...@googlegroups.com
Hi Adrian and Artem,

Thanks for your discussion. Let me add some comments on the R2RML based on our new progress of ontop:)

On Aug 5, 2014, at 16:09, Adrian Brasoveanu <adrian.b...@gmail.com> wrote:

Hello Artem,

I created RDF Data Cubes with ontop, but using directly their mapping language instead of R2RML.
As they say, ontop can be used with anything that uses an ontology....

Few months ago, R2RML implementation from ontop was producing really ugly code....(extremely hard to matain),
therefore using their ontop mapping language offered a better alternative....

Now regarding their ontop mapping language: There were some problems with mapping certain
data types and also with importing ontologies, but other than was fine. Also another limitation with the ontop mapping language
was that at the time you could use only an ontology and just one OBDA and one query file... (not sure if this changed).
Luckily we had different ontologies for different data cubes, therefore this worked for us.
Another approach could be to create the triples and use dummy names and then use a bash script to rewrite those URIs that were dummy.
This would also eliminate the single ontology requirement...but of course it adds a bit of time for the extra URI rewriting involved...

I think the new version of ontop has a new R2RML writer, so I think R2RML problems might be solved…

Yes, we have integrated a new R2RML API. And we spent a lot of efforts to make the ontop compliant with R2RML standard.

However, the new R2RML API does not comes with a R2RML Writer. We still need to use  the sesame API to serialize the RDF representation of the R2RML file. 
We do aware that the ugly R2RML file is very unfriendly to the end users. So the next version of ontop will have a command line tool to convert the “ugly” R2RML file to the pretty one using Jena library. 


we also have a separate demo project demonstrating how to use the R2RML API of ontop from maven. You way want to have a look:





Also the ontop team is great and they helped me a lot :)

Thanks!

--

Fadhil Legowo

unread,
Aug 4, 2018, 10:39:16 PM8/4/18
to ontop4obda
Hi Adrian,

I am also interested in how we can use Ontop to work with RDF Data Cube. Can you share some of the example or tutorial on how to build RDF Data Cubes that you have created with Ontop? 

Any kind of help is much appreciated. Thank you very much.
Reply all
Reply to author
Forward
0 new messages