You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by kumar rohit <ku...@gmail.com> on 2016/05/13 14:58:48 UTC
Individual in Existing ontology
Hello
How can I add an individual in an existing ontology(in Protege) through
Jena code? I have University ontology in protege where I have created
Students and Teachers under "Student and Teacher" classes.
Now I want to add Assistants through Jena code and some properties like his
name, address etc?
Also in most tutorials of Jena there is a URI:
String personURI = "http://somewhere/JohnSmith";
What does this means? In my case, it will be the URI of my Protege
(WWW.semanticweb/myontology/university) and the resource will be added to
this ontology?
I am sure I am wrong but this what my wild guess is?
Regards
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Re: Individual in Existing ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
Kumar,
why can't you first do the Jena tutorials? You have been asking so many
questions now, and each time it looks like you've still to get more
knowledge about the foundations of Semantic Web at all.
What you did in your code is to create an in-memory knowledge base and a
triple (:light :status "on"). That's all. It's quite obvious that you
have to load your ontology into the Jena model. Again, I' suggest to do
the Jena tutorials, which indeed cover loading of data, creating new
data and querying data.
> Thank you
>
> I just want to ask I have this ontology in my protege :
> http://www.semanticweb.org/untitled-ontology-54
>
> And then I wrote this code in Jena,
>
> public class Testclass {
>
> public static void main(String[] args) {
> String ns = "http://www.semanticweb.org/untitled-ontology-54#";
> OntModel model=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
> Resource light = model.createResource(ns+ "light1");
> Property status=model.createProperty(ns+"status");
> Literal value=model.createLiteral("On");
> light.addProperty(status, value);
>
> *So this light1 resource is added where? And how can I combine/query this
> with the resources in my protege ontology?*
>
> *Regards*
>
> On Fri, May 13, 2016 at 7:12 PM, Lorenz buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> There is a documentation for the Jena API[1]
>>
>> [1] https://jena.apache.org/documentation/ontology/
>>
>> On 13.05.2016 16:58, kumar rohit wrote:
>>
>>> Hello
>>>
>>> How can I add an individual in an existing ontology(in Protege) through
>>> Jena code? I have University ontology in protege where I have created
>>> Students and Teachers under "Student and Teacher" classes.
>>> Now I want to add Assistants through Jena code and some properties like
>>> his
>>> name, address etc?
>>>
>>> Also in most tutorials of Jena there is a URI:
>>>
>>> String personURI = "http://somewhere/JohnSmith";
>>>
>>> What does this means? In my case, it will be the URI of my Protege
>>> (WWW.semanticweb/myontology/university) and the resource will be added to
>>> this ontology?
>>>
>>> I am sure I am wrong but this what my wild guess is?
>>>
>>> Regards
>>>
>>> <
>>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>>> Virus-free.
>>> www.avast.com
>>> <
>>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>>> <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Individual in Existing ontology
Posted by kumar rohit <ku...@gmail.com>.
Thank you
I just want to ask I have this ontology in my protege :
http://www.semanticweb.org/untitled-ontology-54
And then I wrote this code in Jena,
public class Testclass {
public static void main(String[] args) {
String ns = "http://www.semanticweb.org/untitled-ontology-54#";
OntModel model=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
Resource light = model.createResource(ns+ "light1");
Property status=model.createProperty(ns+"status");
Literal value=model.createLiteral("On");
light.addProperty(status, value);
*So this light1 resource is added where? And how can I combine/query this
with the resources in my protege ontology?*
*Regards*
On Fri, May 13, 2016 at 7:12 PM, Lorenz buehmann <
buehmann@informatik.uni-leipzig.de> wrote:
> There is a documentation for the Jena API[1]
>
> [1] https://jena.apache.org/documentation/ontology/
>
> On 13.05.2016 16:58, kumar rohit wrote:
>
>> Hello
>>
>> How can I add an individual in an existing ontology(in Protege) through
>> Jena code? I have University ontology in protege where I have created
>> Students and Teachers under "Student and Teacher" classes.
>> Now I want to add Assistants through Jena code and some properties like
>> his
>> name, address etc?
>>
>> Also in most tutorials of Jena there is a URI:
>>
>> String personURI = "http://somewhere/JohnSmith";
>>
>> What does this means? In my case, it will be the URI of my Protege
>> (WWW.semanticweb/myontology/university) and the resource will be added to
>> this ontology?
>>
>> I am sure I am wrong but this what my wild guess is?
>>
>> Regards
>>
>> <
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>> >
>> Virus-free.
>> www.avast.com
>> <
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
>> >
>> <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>>
>
Re: Individual in Existing ontology
Posted by Lorenz buehmann <bu...@informatik.uni-leipzig.de>.
There is a documentation for the Jena API[1]
[1] https://jena.apache.org/documentation/ontology/
On 13.05.2016 16:58, kumar rohit wrote:
> Hello
>
> How can I add an individual in an existing ontology(in Protege) through
> Jena code? I have University ontology in protege where I have created
> Students and Teachers under "Student and Teacher" classes.
> Now I want to add Assistants through Jena code and some properties like his
> name, address etc?
>
> Also in most tutorials of Jena there is a URI:
>
> String personURI = "http://somewhere/JohnSmith";
>
> What does this means? In my case, it will be the URI of my Protege
> (WWW.semanticweb/myontology/university) and the resource will be added to
> this ontology?
>
> I am sure I am wrong but this what my wild guess is?
>
> Regards
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>