You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Don S <do...@gmail.com> on 2012/07/27 10:48:50 UTC

Class Description

HI,

 I posted  this question some times before in Protege community, but I
didn't  received the exact reason. The ontology was developed in Protege
and initially I inserted few tuples manually from the protege editor, after
that start updating the ontology using jena API and SPARQL1.1 Updates  in
my eclipse application. My doubt is the xml code generated for one of the
class named*  "Beats"*  from Protege was start with
* *
<*Beats* rdf:about="http://www.localhost:3030/personal.owl#1">

where as in the case of tuple insertion using Jena gives

<*rdf:Description* rdf:about="http://www.localhost:3030/personal.owl#300">

 Instead of "*rdf:Description"* I want to update the tuples with
"*Beats"*class.

// Insertion part
...........
String queryString ="PREFIX owl: <http://www.localhost:3030/personal.owl#>\r\n"
+
                                  "PREFIX xsd: <
http://www.w3.org/2001/XMLSchema#>\r"+
                               "INSERT DATA" +
                    "{"+
                          "<http://www.localhost:3030/personal.owl#300>\n" +
                           "owl:hasDuration \"" + tDuration + "\"^^
xsd:float;" +
                           "owl:hasFD \"" + fdDuration  + "\"^^ xsd:float;"
+
                                    ...........
                               "}";

Is there a way to solve this.


With regards

Re: top level ontology creation

Posted by Olivier Rossel <ol...@gmail.com>.
You can use owl:imports statements in your upper ontology.
And let Jena manage the imports for you:
cf http://jena.apache.org/documentation/ontology/ Section: "Compound
ontology documents and imports processing" and "Managing file references"

Note: I just read that OWL2 uses imports by location whereas OWL1 was using
import by name.
cf http://protegewiki.stanford.edu/wiki/How_Owl_2.0_Imports_Work




On Fri, May 24, 2013 at 4:39 AM, Bahador(reza)? OFOGHI
<br...@yahoo.com>wrote:

> I think you can do this:OntModelontModel_sub1 =
> ModelFactory.createOntologyModel(...);
> ontModel_sub1 = (OntModel)ontModel_sub1.read("file:"+ "your sub ontology 1
> file");//if the sub ontology is in a file
> OntModelontModel_sub2 = ModelFactory.createOntologyModel(...);
> ontModel_sub2 = (OntModel)ontModel_sub2.read("file:"+ "your sub ontology 2
> file");//if the sub ontology is in a file
>
> OntModelontModel_merged =
> ModelFactory.createOntologyModel(...);ontModel_merged.add(ontModel_sub1);
> ontModel_merged.add(ontModel_sub2);
>
> and I believe you are right to go.
>
> BO
>
>
> ________________________________
>  From: Don <do...@gmail.com>
> To: users@jena.apache.org
> Sent: Friday, 24 May 2013 12:14 PM
> Subject: top level ontology creation
>
>
> HI,
>
>                   I am using jena for my semantic application
> development.  I have a common question. Currently I designed two
> separate ontology for two separate application. My doubt is it possible
> to create a new ontology such that the two previously created ontology
> should be the sub ontology of newly created one. OR should I need to
> create a new ontology from scratch.
>
> With Regards
>

Re: top level ontology creation

Posted by "Bahador(reza)? OFOGHI" <br...@yahoo.com>.
I think you can do this:OntModelontModel_sub1 = ModelFactory.createOntologyModel(...);
ontModel_sub1 = (OntModel)ontModel_sub1.read("file:"+ "your sub ontology 1 file");//if the sub ontology is in a file
OntModelontModel_sub2 = ModelFactory.createOntologyModel(...);
ontModel_sub2 = (OntModel)ontModel_sub2.read("file:"+ "your sub ontology 2 file");//if the sub ontology is in a file
 
OntModelontModel_merged = ModelFactory.createOntologyModel(...);ontModel_merged.add(ontModel_sub1);
ontModel_merged.add(ontModel_sub2);
 
and I believe you are right to go.

BO
  

________________________________
 From: Don <do...@gmail.com>
To: users@jena.apache.org 
Sent: Friday, 24 May 2013 12:14 PM
Subject: top level ontology creation
  

HI,

                  I am using jena for my semantic application 
development.  I have a common question. Currently I designed two 
separate ontology for two separate application. My doubt is it possible 
to create a new ontology such that the two previously created ontology 
should be the sub ontology of newly created one. OR should I need to 
create a new ontology from scratch.

With Regards

top level ontology creation

Posted by Don <do...@gmail.com>.
HI,

                  I am using jena for my semantic application 
development.  I have a common question. Currently I designed two 
separate ontology for two separate application. My doubt is it possible 
to create a new ontology such that the two previously created ontology 
should be the sub ontology of newly created one. OR should I need to 
create a new ontology from scratch.

With Regards



Re: Class Description

Posted by Joshua TAYLOR <jo...@gmail.com>.
On Fri, Jul 27, 2012 at 4:48 AM, Don S <do...@gmail.com> wrote:
>  I posted  this question some times before in Protege community, but I
> didn't  received the exact reason. The ontology was developed in Protege
> and initially I inserted few tuples manually from the protege editor, after
> that start updating the ontology using jena API and SPARQL1.1 Updates  in
> my eclipse application. My doubt is the xml code generated for one of the
> class named*  "Beats"*  from Protege was start with
> * *
> <*Beats* rdf:about="http://www.localhost:3030/personal.owl#1">
>
> where as in the case of tuple insertion using Jena gives
>
> <*rdf:Description* rdf:about="http://www.localhost:3030/personal.owl#300">
>
>  Instead of "*rdf:Description"* I want to update the tuples with
> "*Beats"*class.

RDF can be serialized into XML in many different ways.  First, check
whether the individual that you want to be a Beats has an rdf:type
"...Beats".     For instance, even though you see rdf:Description in
the following RDF/XML, the individual 300 is has type Beat.

  <rdf:Description rdf:about="http://www.localhost:3030/personal.owl#300">
    <rdf:type rdf:resource="http://www.localhost:3030/personal.owl#Beat"/>
  </rdf:Description>

But, if 300 really isn't of type Beat (and looking at the SPARQL
you're using, that wouldn't surprise me), update your SPARQL to assert
that 300 is a Beat ("a" is shorthand for rdf:type, but you can also
use "rdf:type" if you want):

<http://www.localhost:3030/personal.owl#300>
   a <http://www.localhost:3030/personal.owl#Beat> ;
   ...

Hope this helps!

//JT

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/