Re: Populate an owl ontology with mysql database

2013-05-19 Thread Diogo FC Patrao
>
> It's a java portal on a Tomcat server, maybe D2RQ could help me to define
> mappings and populate my owl ontology. Is that the right way to do that?
>
>
D2R can create a default mapping, but you'll end with one class per table,
and one property per column. If you need to map your relational db to
anything different, you'll need to customize the mapping file by hand.

good luck!

dfcp


>
> --
> David DE LA PEÑA
>
>
> On Sun, May 19, 2013 at 3:27 PM, Rob Walpole 
> wrote:
>
> > David,
> >
> > I would suggest using something like D2RQ to dump your data as RDF. You
> may
> > be able to get the mapping you want from this but if not, load it into
> TDB
> > and run some SPARQL transforms (constructs) to get it how you want it.
> >
> > Rob
> > On May 19, 2013 11:58 AM, "David De La Peña"  wrote:
> >
> > > Hello,
> > > could I use Jena to populate individuals form a mysql db to an owl
> > > ontology?
> > >
> > > Thank you,
> > >
> > > --
> > > David DE LA PEÑA
> > >
> >
>


Re: Populate an owl ontology with mysql database

2013-05-19 Thread David De La Peña
Thank you!
It seems to do want I want.

To explain what I'm doing : I've first create an ontology (owl file with
Protege 4) and now I am developing a web portal referring to this ontology
( but not directly linked to it ).
Now I want to display in this web portal the ontology populated with the
individuals that are stored in the portal db.

My Goal is to visualize in a web page of the portal, the ontology and his
individuals (populated dynamically from the portal db) using semantic
queries.

It's a java portal on a Tomcat server, maybe D2RQ could help me to define
mappings and populate my owl ontology. Is that the right way to do that?


-- 
David DE LA PEÑA


On Sun, May 19, 2013 at 3:27 PM, Rob Walpole  wrote:

> David,
>
> I would suggest using something like D2RQ to dump your data as RDF. You may
> be able to get the mapping you want from this but if not, load it into TDB
> and run some SPARQL transforms (constructs) to get it how you want it.
>
> Rob
> On May 19, 2013 11:58 AM, "David De La Peña"  wrote:
>
> > Hello,
> > could I use Jena to populate individuals form a mysql db to an owl
> > ontology?
> >
> > Thank you,
> >
> > --
> > David DE LA PEÑA
> >
>


Re: Problem with rdfs:subClassOf* and TDB (Jena 2.10)

2013-05-19 Thread Christian Jauvin
> No - you have to delete the old database, it does not overwrite, it adds
> stuff to the database.

You're right: I deleted the data files before running tdbloader, and
the problem went away. I should have checked that before posting,
sorry!

Thanks,

Christian


Re: Problem with rdfs:subClassOf* and TDB (Jena 2.10)

2013-05-19 Thread Andy Seaborne



On 19/05/13 16:08, Christian Jauvin wrote:

Hi Andy,

Thanks for the answer.


It looks like the node table is corrupted from a previous run after
non-transactional update and exisitng the JVM without calling
TDB.sync(dataset)


I'm really a Jena/TDB beginner, so please bear with me, but as I've
been (1) "tdbloading" my store and (2) "tdbquerying" simple select
SPARQL queries right away, it would seem to me that no
non-transactional update has been performed anyhow. To be sure, I just
reloaded it (assuming that re-running tdbquery completely overrides
any previous problem of the kind you describe).


Christian,

No - you have to delete the old database, it does not overwrite, it adds 
stuff to the database.


If, reloading from empty, it still breaks, could you post the data (if 
small) or put it online somewhere I can get it from?


What is the setup?  Operating system?  Java (32 or 64 bit?)

Andy




select (count(?x) as ?cnt)
where { ?x rdfs:subClassOf* ?y }



select (count(?x) as ?cnt)
where { ?x rdfs:subClassOf ?y }


In the first case, the system does need to access the node value of ?y
because * is done by a general engine on nodes where as the plain pattern
does not access the string that represents ?y so never touches some parts of
the node table.


If I understand you well, shouldn't then this query

select ?x ?y
where { ?x rdfs:subClassOf* ?y }

work? It's still producing the same error though, even after a fresh tdbload.

Christian





Re: Problem with rdfs:subClassOf* and TDB (Jena 2.10)

2013-05-19 Thread Christian Jauvin
Hi Andy,

Thanks for the answer.

> It looks like the node table is corrupted from a previous run after
> non-transactional update and exisitng the JVM without calling
> TDB.sync(dataset)

I'm really a Jena/TDB beginner, so please bear with me, but as I've
been (1) "tdbloading" my store and (2) "tdbquerying" simple select
SPARQL queries right away, it would seem to me that no
non-transactional update has been performed anyhow. To be sure, I just
reloaded it (assuming that re-running tdbquery completely overrides
any previous problem of the kind you describe).

>> select (count(?x) as ?cnt)
>> where { ?x rdfs:subClassOf* ?y }
>
>> select (count(?x) as ?cnt)
>> where { ?x rdfs:subClassOf ?y }
>
> In the first case, the system does need to access the node value of ?y
> because * is done by a general engine on nodes where as the plain pattern
> does not access the string that represents ?y so never touches some parts of
> the node table.

If I understand you well, shouldn't then this query

select ?x ?y
where { ?x rdfs:subClassOf* ?y }

work? It's still producing the same error though, even after a fresh tdbload.

Christian


Re: Populate an owl ontology with mysql database

2013-05-19 Thread Rob Walpole
David,

I would suggest using something like D2RQ to dump your data as RDF. You may
be able to get the mapping you want from this but if not, load it into TDB
and run some SPARQL transforms (constructs) to get it how you want it.

Rob
On May 19, 2013 11:58 AM, "David De La Peña"  wrote:

> Hello,
> could I use Jena to populate individuals form a mysql db to an owl
> ontology?
>
> Thank you,
>
> --
> David DE LA PEÑA
>


Re: Populate an owl ontology with mysql database

2013-05-19 Thread Diogo FC Patrao
Hello David

Not sure how your data is arranged on MySQL, but have a look on D2R (
http://d2rq.org/), which maps relational data to RDF.

cheers

--
diogo patrão




On Sun, May 19, 2013 at 7:57 AM, David De La Peña  wrote:

> Hello,
> could I use Jena to populate individuals form a mysql db to an owl
> ontology?
>
> Thank you,
>
> --
> David DE LA PEÑA
>


Re: Populate an owl ontology with mysql database

2013-05-19 Thread David De La Peña
Hello,
could I use Jena to populate individuals form a mysql db to an owl ontology?

Thank you,

-- 
David DE LA PEÑA


Re: Problem with rdfs:subClassOf* and TDB (Jena 2.10)

2013-05-19 Thread Andy Seaborne

On 18/05/13 16:09, Christian Jauvin wrote:

Hi,

I'm using TDB (Jena 2.10) and this simple SPARQL query (run with
"tdbquery") over a store of ~1000 triples (which is actually a dump of
an OWL ontology):

select (count(?x) as ?cnt)
where { ?x rdfs:subClassOf* ?y }

gives the error:

11:03:03 ERROR TDB  ::
ObjectFileStorage.read[nodes.dat](16221)[filesize=49330][file.size()=49330]:
Impossibly large object : 825189752 bytes >
filesize-(loc+SizeOfInt)=33105
com.hp.hpl.jena.tdb.base.file.FileException:
ObjectFileStorage.read[nodes.dat](16221)[filesize=49330][file.size()=49330]:
Impossibly large object : 825189752 bytes >
filesize-(loc+SizeOfInt)=33105
at 
com.hp.hpl.jena.tdb.base.objectfile.ObjectFileStorage.read(ObjectFileStorage.java:346)
at com.hp.hpl.jena.tdb.lib.NodeLib.fetchDecode(NodeLib.java:78)
[...]

whereas the same query, over the same ontology in Protege runs fine
(and yields a count of 3062, proving that this is not an "impossibly
large object").

Note that the same query, with the non-transitive version of the operator:

select (count(?x) as ?cnt)
where { ?x rdfs:subClassOf ?y }

runs fine in TDB (and yields 170).

Thanks,

Christian



Hi Christian,

It looks like the node table is corrupted from a previous run after 
non-transactional update and exisitng the JVM without calling 
TDB.sync(dataset)


The "Impossibly large object" is because it's reading bytes making up 
another node as a length count.


> select (count(?x) as ?cnt)
> where { ?x rdfs:subClassOf* ?y }

> select (count(?x) as ?cnt)
> where { ?x rdfs:subClassOf ?y }

In the first case, the system does need to access the node value of ?y 
because * is done by a general engine on nodes where as the plain 
pattern does not access the string that represents ?y so never touches 
some parts of the node table.


Andy