Re: Wikidata vs DBpedia

2017-03-20 Thread kumar rohit
Hello Lorenz, if it can not be extracted like DBpedia then how can we use
it in our application. Several month ago, I asked a question, I think here,
that if some data is not available on DBpedia, what we should do and some
body respond that do use Wikidata.
How can we make use of Wikidata in our applications?

On Mon, Mar 20, 2017 at 10:32 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> That question could be applied to any other thing in the world where two
> possible options exists...
>
> "why should I use A if I can do what I want already with B?"
>
> I'd suggest read more about Wikidata in your case, then it should be
> clear that Wikidata provides a totally different concept how the data is
> added. It does not extract data from Wikipedia, as DBpedia does, is a
> user curated source for for structured information which is included in
> Wikipedia.
>
> > I am sorry if it is slightly off topic.
> >
> > How Wikidata differs from DBpedia, in terms of building semantic web
> > applications. Wikidata, as I studied as, is a knowledge base which every
> > one can edit? How it differs then from Wikipedia?
> >
> > DBpedia extracts structured data from wikipedia infoboxes and publishes
> it
> > as rdf.
> >
> > If we need Berlin population, we get it from DBpedia via SPARQL. If we
> can
> > do it, why then we need Berlin resource in Wikidata?
> >
> > This question will look strange for some, but I want to understand the
> > concept.
> > Thank you
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Wikidata vs DBpedia

2017-03-19 Thread kumar rohit
I am sorry if it is slightly off topic.

How Wikidata differs from DBpedia, in terms of building semantic web
applications. Wikidata, as I studied as, is a knowledge base which every
one can edit? How it differs then from Wikipedia?

DBpedia extracts structured data from wikipedia infoboxes and publishes it
as rdf.

If we need Berlin population, we get it from DBpedia via SPARQL. If we can
do it, why then we need Berlin resource in Wikidata?

This question will look strange for some, but I want to understand the
concept.
Thank you


Re: Error in rdfs rule

2017-03-09 Thread kumar rohit
Yes Lorenz thank you, it runs now.

On Thu, Mar 9, 2017 at 4:27 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Does it work if you remove the second term which is - as I said -
> superflous?
>
> > I am sorry if it still appears unclear. The rule seems ok as I have
> > discussed it with another person but why the error comes, dont know.
> > There are other generic rules which works fine but when I include this
> > rule, it gives error.
> >
> > On Thu, Mar 9, 2017 at 3:35 PM, kumar rohit <kumar.en...@gmail.com>
> wrote:
> >
> >> *This is print out of string.*
> >>
> >> *(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >> http://www.semanticweb.org/t/ontologies#MasterStudent
> >> <http://www.semanticweb.org/t/ontologies#MasterStudent>) (
> >> http://www.semanticweb.org/t/ontologies#MasterStudent
> >> <http://www.semanticweb.org/t/ontologies#MasterStudent>)
> >> http://www.w3.org/2000/01/rdf-schema#subClassOf
> >> <http://www.w3.org/2000/01/rdf-schema#subClassOf>
> >> http://www.semanticweb.org/t/ontologies#Student
> >> <http://www.semanticweb.org/t/ontologies#Student> ) ->  (?x
> >> http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >> http://www.semanticweb.org/t/ontologies#Student
> >> <http://www.semanticweb.org/t/ontologies#Student> )] *
> >>
> >> On Thu, Mar 9, 2017 at 1:54 PM, Lorenz B. <buehm...@informatik.uni-
> >> leipzig.de> wrote:
> >>
> >>> No no no. Print the String of the rule to the command line and show
> this
> >>> one to us.
> >>> The current one isn't readable and can't be parsed for sure. And how
> >>> should #MasterStudent be resolved?
> >>>
> >>> And don't us such an old version of Jena! Version 3.2.0 is already
> >>> available.
> >>>
> >>>> The rule error is
> >>>>
> >>>> Exception in thread "AWT-EventQueue-0"
> >>>> com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 1
> >>> nodes!
> >>>>
> >>>> The rule is
> >>>>
> >>>>
> >>>> [rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >>>> #MasterStudent) "
> >>>>
> >>>>  + "(#MasterStudent   http://www.w3.org/2000/01/
> >>> rdf-schema#subClassOf
> >>>>  #Student )"
> >>>>
> >>>>
> >>>> + " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >>>> #Student )]";
> >>>>
> >>>> On Thu, Mar 9, 2017 at 11:46 AM, Lorenz B. <
> >>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>
> >>>>> That doesn't solve your original problem, please provide the error!
> >>>>>
> >>>>> RDFS reasoning is enough to cover that kind if inference, please read
> >>>>> the documentation (as usual) [1]
> >>>>>
> >>>>> [1] https://jena.apache.org/documentation/inference/
> >>>>>> Thanks a lot Dave, Lorenz, so it means I dont have to write these
> >>> rules
> >>>>> and
> >>>>>> it will be inferred automatically? How it will be executed,? I have
> >>>>> default
> >>>>>> model with no parameters and then the inferred model.
> >>>>>> Should I pass the "OntModelSpec.OWL_MEM_MICRO_RULE_INF " to the
> >>> default
> >>>>>> model?
> >>>>>>
> >>>>>> On Thu, Mar 9, 2017 at 10:14 AM, Lorenz B. <
> >>>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>>
> >>>>>>> 1. That rule is unreadable again - at least for me. See how it is
> >>> shown
> >>>>>>> to the mailing list: http://jena.markmail.org/threa
> >>> d/akjkia6mysqhsq2i
> >>>>>>> 2. Don't show the Java concatenated string but the rule as it's
> >>> printed
> >>>>>>> to the command line/console. Especially hereby one can see trivial
> >>>>>>> syntax errors
> >>>>>>> 3. As Dave said, it's totally unclear why you're always omitting
> &g

Re: Error in rdfs rule

2017-03-09 Thread kumar rohit
I am sorry if it still appears unclear. The rule seems ok as I have
discussed it with another person but why the error comes, dont know.
There are other generic rules which works fine but when I include this
rule, it gives error.

On Thu, Mar 9, 2017 at 3:35 PM, kumar rohit <kumar.en...@gmail.com> wrote:

> *This is print out of string.*
>
> *(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> http://www.semanticweb.org/t/ontologies#MasterStudent
> <http://www.semanticweb.org/t/ontologies#MasterStudent>) (
> http://www.semanticweb.org/t/ontologies#MasterStudent
> <http://www.semanticweb.org/t/ontologies#MasterStudent>)
> http://www.w3.org/2000/01/rdf-schema#subClassOf
> <http://www.w3.org/2000/01/rdf-schema#subClassOf>
> http://www.semanticweb.org/t/ontologies#Student
> <http://www.semanticweb.org/t/ontologies#Student> ) ->  (?x
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> http://www.semanticweb.org/t/ontologies#Student
> <http://www.semanticweb.org/t/ontologies#Student> )] *
>
> On Thu, Mar 9, 2017 at 1:54 PM, Lorenz B. <buehm...@informatik.uni-
> leipzig.de> wrote:
>
>> No no no. Print the String of the rule to the command line and show this
>> one to us.
>> The current one isn't readable and can't be parsed for sure. And how
>> should #MasterStudent be resolved?
>>
>> And don't us such an old version of Jena! Version 3.2.0 is already
>> available.
>>
>> > The rule error is
>> >
>> > Exception in thread "AWT-EventQueue-0"
>> > com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 1
>> nodes!
>> >
>> >
>> > The rule is
>> >
>> >
>> > [rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>> > #MasterStudent) "
>> >
>> >  + "(#MasterStudent   http://www.w3.org/2000/01/
>> rdf-schema#subClassOf
>> >  #Student )"
>> >
>> >
>> > + " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>> > #Student )]";
>> >
>> > On Thu, Mar 9, 2017 at 11:46 AM, Lorenz B. <
>> > buehm...@informatik.uni-leipzig.de> wrote:
>> >
>> >> That doesn't solve your original problem, please provide the error!
>> >>
>> >> RDFS reasoning is enough to cover that kind if inference, please read
>> >> the documentation (as usual) [1]
>> >>
>> >> [1] https://jena.apache.org/documentation/inference/
>> >>> Thanks a lot Dave, Lorenz, so it means I dont have to write these
>> rules
>> >> and
>> >>> it will be inferred automatically? How it will be executed,? I have
>> >> default
>> >>> model with no parameters and then the inferred model.
>> >>> Should I pass the "OntModelSpec.OWL_MEM_MICRO_RULE_INF " to the
>> default
>> >>> model?
>> >>>
>> >>> On Thu, Mar 9, 2017 at 10:14 AM, Lorenz B. <
>> >>> buehm...@informatik.uni-leipzig.de> wrote:
>> >>>
>> >>>> 1. That rule is unreadable again - at least for me. See how it is
>> shown
>> >>>> to the mailing list: http://jena.markmail.org/threa
>> d/akjkia6mysqhsq2i
>> >>>> 2. Don't show the Java concatenated string but the rule as it's
>> printed
>> >>>> to the command line/console. Especially hereby one can see trivial
>> >>>> syntax errors
>> >>>> 3. As Dave said, it's totally unclear why you're always omitting
>> obvious
>> >>>> details - what kind of exception?
>> >>>> 4. The rule doesn't make sense, since the second term of the premise
>> >>>> doesn't contain any variable. It's not clear what you want to achieve
>> >> here.
>> >>>> (?x rdf:type :MasterStudent ) (:MasterStudent rdfs:subClassOf
>> :Student )
>> >>>> -> (?x rdf:type :Student )
>> >>>>
>> >>>> That rule would be covered by the rdf:type/rdfs:subClassOf rule in
>> RDFS:
>> >>>>
>> >>>> (?x rdf:type ?C) (?C rdfs:subClassOf ?D) -> (?x rdf:type ?D)
>> >>>>
>> >>>> But in your rule the second term doesn't contribute to the reasoning
>> >>>> process. The result would be the same with
>> >>>>
>> >>>> (?x rdf:type :MasterStud

Re: Error in rdfs rule

2017-03-09 Thread kumar rohit
*This is print out of string.*

*(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
http://www.semanticweb.org/t/ontologies#MasterStudent
<http://www.semanticweb.org/t/ontologies#MasterStudent>) (
http://www.semanticweb.org/t/ontologies#MasterStudent
<http://www.semanticweb.org/t/ontologies#MasterStudent>)
http://www.w3.org/2000/01/rdf-schema#subClassOf
<http://www.w3.org/2000/01/rdf-schema#subClassOf>
http://www.semanticweb.org/t/ontologies#Student
<http://www.semanticweb.org/t/ontologies#Student> ) ->  (?x
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
http://www.semanticweb.org/t/ontologies#Student
<http://www.semanticweb.org/t/ontologies#Student> )] *

On Thu, Mar 9, 2017 at 1:54 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> No no no. Print the String of the rule to the command line and show this
> one to us.
> The current one isn't readable and can't be parsed for sure. And how
> should #MasterStudent be resolved?
>
> And don't us such an old version of Jena! Version 3.2.0 is already
> available.
>
> > The rule error is
> >
> > Exception in thread "AWT-EventQueue-0"
> > com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 1
> nodes!
> >
> >
> > The rule is
> >
> >
> > [rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> > #MasterStudent) "
> >
> >  + "(#MasterStudent   http://www.w3.org/2000/01/rdf-
> schema#subClassOf
> >  #Student )"
> >
> >
> > + " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> > #Student )]";
> >
> > On Thu, Mar 9, 2017 at 11:46 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> That doesn't solve your original problem, please provide the error!
> >>
> >> RDFS reasoning is enough to cover that kind if inference, please read
> >> the documentation (as usual) [1]
> >>
> >> [1] https://jena.apache.org/documentation/inference/
> >>> Thanks a lot Dave, Lorenz, so it means I dont have to write these rules
> >> and
> >>> it will be inferred automatically? How it will be executed,? I have
> >> default
> >>> model with no parameters and then the inferred model.
> >>> Should I pass the "OntModelSpec.OWL_MEM_MICRO_RULE_INF " to the
> default
> >>> model?
> >>>
> >>> On Thu, Mar 9, 2017 at 10:14 AM, Lorenz B. <
> >>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> 1. That rule is unreadable again - at least for me. See how it is
> shown
> >>>> to the mailing list: http://jena.markmail.org/thread/akjkia6mysqhsq2i
> >>>> 2. Don't show the Java concatenated string but the rule as it's
> printed
> >>>> to the command line/console. Especially hereby one can see trivial
> >>>> syntax errors
> >>>> 3. As Dave said, it's totally unclear why you're always omitting
> obvious
> >>>> details - what kind of exception?
> >>>> 4. The rule doesn't make sense, since the second term of the premise
> >>>> doesn't contain any variable. It's not clear what you want to achieve
> >> here.
> >>>> (?x rdf:type :MasterStudent ) (:MasterStudent rdfs:subClassOf
> :Student )
> >>>> -> (?x rdf:type :Student )
> >>>>
> >>>> That rule would be covered by the rdf:type/rdfs:subClassOf rule in
> RDFS:
> >>>>
> >>>> (?x rdf:type ?C) (?C rdfs:subClassOf ?D) -> (?x rdf:type ?D)
> >>>>
> >>>> But in your rule the second term doesn't contribute to the reasoning
> >>>> process. The result would be the same with
> >>>>
> >>>> (?x rdf:type :MasterStudent ) -> (?x rdf:type :Student )
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> On 08/03/17 13:29, kumar rohit wrote:
> >>>>>> Is there any problem in this rule. I am getting error here.
> >>>>> What error?
> >>>>>
> >>>>> It is much easier for us to help if you say explicitly what went
> wrong!
> >>>>>
> >>>>>> I used jena
> >>>>>> generic rule reasoner so is it sufficient also for executing rdfs
> sub
> >>>>>> class
> >>>>>> rules?
> >>>>

Re: Error in rdfs rule

2017-03-09 Thread kumar rohit
The rule error is

Exception in thread "AWT-EventQueue-0"
com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 1 nodes!


The rule is


[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#MasterStudent) "

 + "(#MasterStudent   http://www.w3.org/2000/01/rdf-schema#subClassOf
 #Student )"


+ " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#Student )]";

On Thu, Mar 9, 2017 at 11:46 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> That doesn't solve your original problem, please provide the error!
>
> RDFS reasoning is enough to cover that kind if inference, please read
> the documentation (as usual) [1]
>
> [1] https://jena.apache.org/documentation/inference/
> > Thanks a lot Dave, Lorenz, so it means I dont have to write these rules
> and
> > it will be inferred automatically? How it will be executed,? I have
> default
> > model with no parameters and then the inferred model.
> > Should I pass the "OntModelSpec.OWL_MEM_MICRO_RULE_INF " to the default
> > model?
> >
> > On Thu, Mar 9, 2017 at 10:14 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> 1. That rule is unreadable again - at least for me. See how it is shown
> >> to the mailing list: http://jena.markmail.org/thread/akjkia6mysqhsq2i
> >> 2. Don't show the Java concatenated string but the rule as it's printed
> >> to the command line/console. Especially hereby one can see trivial
> >> syntax errors
> >> 3. As Dave said, it's totally unclear why you're always omitting obvious
> >> details - what kind of exception?
> >> 4. The rule doesn't make sense, since the second term of the premise
> >> doesn't contain any variable. It's not clear what you want to achieve
> here.
> >>
> >> (?x rdf:type :MasterStudent ) (:MasterStudent rdfs:subClassOf :Student )
> >> -> (?x rdf:type :Student )
> >>
> >> That rule would be covered by the rdf:type/rdfs:subClassOf rule in RDFS:
> >>
> >> (?x rdf:type ?C) (?C rdfs:subClassOf ?D) -> (?x rdf:type ?D)
> >>
> >> But in your rule the second term doesn't contribute to the reasoning
> >> process. The result would be the same with
> >>
> >> (?x rdf:type :MasterStudent ) -> (?x rdf:type :Student )
> >>
> >>
> >>
> >>
> >>
> >>> On 08/03/17 13:29, kumar rohit wrote:
> >>>> Is there any problem in this rule. I am getting error here.
> >>> What error?
> >>>
> >>> It is much easier for us to help if you say explicitly what went wrong!
> >>>
> >>>> I used jena
> >>>> generic rule reasoner so is it sufficient also for executing rdfs sub
> >>>> class
> >>>> rules?
> >>>>
> >>>> *[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >>>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >>>>  http://www.semanticweb.org/t/ontologies#MasterStudent
> >>>> <http://www.semanticweb.org/t/ontologies#MasterStudent>) "*
> >>>> *+ "( http://www.semanticweb.org/t/ontologies#MasterStudent
> >>>> <http://www.semanticweb.org/t/ontologies#MasterStudent>)
> >>>>  http://www.w3.org/2000/01/rdf-schema#subClassOf
> >>>> <http://www.w3.org/2000/01/rdf-schema#subClassOf>
> >>>>  http://www.semanticweb.org/t/ontologies#Student
> >>>> <http://www.semanticweb.org/t/ontologies#Student> )"*
> >>>>
> >>>>
> >>>> *+ " ->  (?x http://www.w3.org/1999/02/22-
> >> rdf-syntax-ns#type
> >>>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >>>> http://www.semanticweb.org/t/ontologies#Student
> >>>> <http://www.semanticweb.org/t/ontologies#Student> )]"*
> >>> Almost impossible to read but at a glance it looks OK.
> >>>
> >>> 1. Please post messages as plain text. Your emailer has done horrid
> >>> things to the URIs.
> >>>
> >>> 2. The rule would be much easier to read if you use prefixes instead
> >>> of writing out the URIs longhand.
> >>>
> >>> 3. It's also possible to use the standard generic RDFS rules. You
> >>> don't have to write out your own special case rules for each
> >>> subClassOf relationship.
> >>>
> >>> Dave
> >>>
> >>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Error in rdfs rule

2017-03-09 Thread kumar rohit
Thanks a lot Dave, Lorenz, so it means I dont have to write these rules and
it will be inferred automatically? How it will be executed,? I have default
model with no parameters and then the inferred model.
Should I pass the "OntModelSpec.OWL_MEM_MICRO_RULE_INF " to the default
model?

On Thu, Mar 9, 2017 at 10:14 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> 1. That rule is unreadable again - at least for me. See how it is shown
> to the mailing list: http://jena.markmail.org/thread/akjkia6mysqhsq2i
> 2. Don't show the Java concatenated string but the rule as it's printed
> to the command line/console. Especially hereby one can see trivial
> syntax errors
> 3. As Dave said, it's totally unclear why you're always omitting obvious
> details - what kind of exception?
> 4. The rule doesn't make sense, since the second term of the premise
> doesn't contain any variable. It's not clear what you want to achieve here.
>
> (?x rdf:type :MasterStudent ) (:MasterStudent rdfs:subClassOf :Student )
> -> (?x rdf:type :Student )
>
> That rule would be covered by the rdf:type/rdfs:subClassOf rule in RDFS:
>
> (?x rdf:type ?C) (?C rdfs:subClassOf ?D) -> (?x rdf:type ?D)
>
> But in your rule the second term doesn't contribute to the reasoning
> process. The result would be the same with
>
> (?x rdf:type :MasterStudent ) -> (?x rdf:type :Student )
>
>
>
>
>
> > On 08/03/17 13:29, kumar rohit wrote:
> >> Is there any problem in this rule. I am getting error here.
> >
> > What error?
> >
> > It is much easier for us to help if you say explicitly what went wrong!
> >
> >> I used jena
> >> generic rule reasoner so is it sufficient also for executing rdfs sub
> >> class
> >> rules?
> >>
> >> *[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >>  http://www.semanticweb.org/t/ontologies#MasterStudent
> >> <http://www.semanticweb.org/t/ontologies#MasterStudent>) "*
> >> *+ "( http://www.semanticweb.org/t/ontologies#MasterStudent
> >> <http://www.semanticweb.org/t/ontologies#MasterStudent>)
> >>  http://www.w3.org/2000/01/rdf-schema#subClassOf
> >> <http://www.w3.org/2000/01/rdf-schema#subClassOf>
> >>  http://www.semanticweb.org/t/ontologies#Student
> >> <http://www.semanticweb.org/t/ontologies#Student> )"*
> >>
> >>
> >> *+ " ->  (?x http://www.w3.org/1999/02/22-
> rdf-syntax-ns#type
> >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> >> http://www.semanticweb.org/t/ontologies#Student
> >> <http://www.semanticweb.org/t/ontologies#Student> )]"*
> >
> > Almost impossible to read but at a glance it looks OK.
> >
> > 1. Please post messages as plain text. Your emailer has done horrid
> > things to the URIs.
> >
> > 2. The rule would be much easier to read if you use prefixes instead
> > of writing out the URIs longhand.
> >
> > 3. It's also possible to use the standard generic RDFS rules. You
> > don't have to write out your own special case rules for each
> > subClassOf relationship.
> >
> > Dave
> >
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
>


Error in rdfs rule

2017-03-08 Thread kumar rohit
Is there any problem in this rule. I am getting error here. I used jena
generic rule reasoner so is it sufficient also for executing rdfs sub class
rules?

*[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type

 http://www.semanticweb.org/t/ontologies#MasterStudent
) "*
*+ "( http://www.semanticweb.org/t/ontologies#MasterStudent
)
 http://www.w3.org/2000/01/rdf-schema#subClassOf

 http://www.semanticweb.org/t/ontologies#Student
 )"*


*+ " ->  (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type

http://www.semanticweb.org/t/ontologies#Student
 )]"*


* Reasoner reasoner2 = new
GenericRuleReasoner(Rule.parseRules(rule)); InfModel inf =
ModelFactory.createInfModel(reasoner2, model);*


Re: full URI of rdfs sub class

2017-03-07 Thread kumar rohit
Thank you Simon,

On Tue, Mar 7, 2017 at 6:57 PM, Simon Schäfer <m...@antoras.de> wrote:

> You can search for rdfs here: http://prefix.cc/
>
> This leads to a document where rdfs:subClassOf is defined.
>
>
>  On Tue, 07 Mar 2017 14:58:20 +0100 kumar rohit <kumar.en...@gmail.com>
> wrote 
>
>  > I have a rule like if x is type of Student and student rdfs:subclass of
>  > Human, then x is type of Human
>  >
>  > What is the full URI of rdfs subclassOf to write in rules like we write
>  > http://www.w3.org/1999/02/22-rdf-syntax-ns#type for rdf:type?
>  >
>
>
>


full URI of rdfs sub class

2017-03-07 Thread kumar rohit
I have a rule like if x is type of Student and student rdfs:subclass of
Human, then x is type of Human

What is the full URI of rdfs subclassOf to write in rules like we write
http://www.w3.org/1999/02/22-rdf-syntax-ns#type for rdf:type?


Get value from Annotation tab

2017-02-26 Thread kumar rohit
Hi, is it possible we get value from annotation tab as we do from property
like getPropertyValue();


Re: Benefits of Semantic web

2017-02-12 Thread kumar rohit
ut i also want to describe something for the future:
> >>>>
> >>>> I imagine, a cheekily developer constructs a small, easily
> understandable
> >>>> and effectively implementable  'subset' of the whole thing 'Semantic
> Web'
> >>>> defining a new playing field or making great progress in usual apps of
> >>>> today.
> >>>>
> >>>> This cold be the realisation of TBL cit. (about 20 years ago?): 'The
> most
> >>>> exciting things about Semantic Web is not what we can imagine to do
> with
> >>>> it, but we can't yet imagine it will do.'
> >>>>
> >>>> First step is always a very simple and comprehensible idea.. This
> means
> >>>> downsizing the whole thing to a simplified kernel for a special
> >>>> application
> >>>> field... Better late than never...
> >>>>
> >>>> This is really what i instinctively think about this stuff after so
> many
> >>>> years. I know, such things are totally off topic for Jena team, but my
> >>>> posting is for 2 or 3 users who can be interested, if it is allowed...
> >>>>
> >>>> thanks, baran.
> >>>>
> >>>> 
> >>>>
> >>>>
> >>>>
> >>>> On 10/02/17 12:22, kumar rohit wrote:
> >>>>
> >>>>>> Hi, what are the benefits of semantic web technologies? I have used
> >>>>>>
> >>>>>>> semantic web technologies from one year but, in theory I am not
> sure
> >>>>>>> the
> >>>>>>> real advantages of semantic web.
> >>>>>>> When we develop a system using traditional RDBMS and Java and same
> >>>>>>> system
> >>>>>>> we develop using Java/Jena Protege SPARQL etc, so what is the
> >>>>>>> advantage
> >>>>>>> of
> >>>>>>> the latter application?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>> --
> >>>> Using Opera's mail client: http://www.opera.com/mail/
> >>>>
> >>>>
> >> --
> >> Using Opera's mail client: http://www.opera.com/mail/
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Benefits of Semantic web

2017-02-12 Thread kumar rohit
Thanks all for explanation.

I still need some explanation. What is the advantage of using ontology in
our semantic web application. Its just that we can share it?

Second, what is the advantage of Jena rules? A task completed with an RDF
API and same task with Jena rules, why people prefer rules?

Thanks.

On Sun, Feb 12, 2017 at 11:28 AM, <baran...@gmail.com> wrote:

>
> Adrian, i think this is a rather old and not yet fully developed
> application with a UI needing a bit freshing up for smoothly working,
> databases are (I tried with commodities1/2) also old and rather small. Is
> gold no commodity? if i put a question with an agent the effect is only
> reordering the list of general questions. My suggestion is: Let at first as
> input for an agent not only questions but also the option of a single item
> and then give a list of possible questions the agent can answer exactly for
> this item. May be i couldn't get everything so how it is meant...
>
> But the idea as whole has some original aspects, that was really what i
> meant: Trying away from heavy classical view of SPARQL databases connected
> to certain ontologies with a lot of small surprising error effects in
> developement, so that people ask: Why dont you make a simple SQL database,
> you talk then about Semantic Web, Linked Data basing on triples and URI's
> and of course about public endpoints. Then comes the question: 'public'
> endpoints with this performance where SPARQL only an adapted SQL for
> triples is? etc...
>
> I think you could next fresh up your concept if you have time for it, the
> other question is how it would react under heavy usage... This is my
> comment after 20 minutes, sorry that i had not much more time...
>
> **
>
>
> On Sun, 12 Feb 2017 07:05:54 +0100, Adrian Walker <adriandwal...@gmail.com>
> wrote:
>
> Baran,
>>
>> You wrote:
>> *This means downsizing the whole thing to a simplified kernel for a
>> special
>> application field.*
>> Here's a simplified kernel that arguably covers wider version of
>> application semantics than the usual "semantic web"  tools.
>>
>> Here's a summary slide:
>>
>> www.executable-english.com/internet_business_logic_in_a_nutshell.pdf
>>
>> The system that supports this is live, online at
>> www.executable-english.com.
>>
>>
>> Shared use is free, and there are no advertisements.  Nothing to download,
>> just point a browser to the site.
>>
>> Thanks for comments,-- Adrian
>>
>> Adrian Walker
>> Reengineering LLC
>> San Jose, CA, USA
>> 860 830 2085
>>
>>
>>
>> On Sat, Feb 11, 2017 at 4:33 AM, <baran...@gmail.com> wrote:
>>
>> Hello,
>>>
>>> On Fri, 10 Feb 2017 18:02:46 +0100, David Jordan <
>>> jdavidjorda...@gmail.com>
>>> wrote:
>>>
>>> I agree that have some discussion about this is very useful. Many of us
>>>
>>>> have tried to evangelize semantic web technologies in our organizations
>>>> and > have struggled and failed because we cannot provide sufficient
>>>> justification for using the technology. Hearing the specific value
>>>> provided that can convince the skeptics is extremely valuable, much more
>>>> valuable
>>>> than simple support questions about a particular API interface.
>>>>
>>>>
>>>
>>> yes, i thing similar things, also like others responding to this thread
>>> in
>>> an open minded way...
>>>
>>> But i also want to describe something for the future:
>>>
>>> I imagine, a cheekily developer constructs a small, easily understandable
>>> and effectively implementable  'subset' of the whole thing 'Semantic Web'
>>> defining a new playing field or making great progress in usual apps of
>>> today.
>>>
>>> This cold be the realisation of TBL cit. (about 20 years ago?): 'The most
>>> exciting things about Semantic Web is not what we can imagine to do with
>>> it, but we can't yet imagine it will do.'
>>>
>>> First step is always a very simple and comprehensible idea.. This means
>>> downsizing the whole thing to a simplified kernel for a special
>>> application
>>> field... Better late than never...
>>>
>>> This is really what i instinctively think about this stuff after so many
>>> years. I know, such things are totally off topic for Jena team, but my
>>> posting is for 2 or 3 users who can be interested, if it is allowed...
>>>
>>> thanks, baran.
>>>
>>> 
>>>
>>>
>>>
>>> On 10/02/17 12:22, kumar rohit wrote:
>>>
>>>>
>>>>> Hi, what are the benefits of semantic web technologies? I have used
>>>>>
>>>>>> semantic web technologies from one year but, in theory I am not sure
>>>>>> the
>>>>>> real advantages of semantic web.
>>>>>> When we develop a system using traditional RDBMS and Java and same
>>>>>> system
>>>>>> we develop using Java/Jena Protege SPARQL etc, so what is the
>>>>>> advantage
>>>>>> of
>>>>>> the latter application?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>> --
>>> Using Opera's mail client: http://www.opera.com/mail/
>>>
>>>
>
> --
> Using Opera's mail client: http://www.opera.com/mail/
>


What are the Alternatives of DBpedia

2017-01-15 Thread kumar rohit
I want to know, like DBpdia, what are other sources where we can get data
from and supported also by Jena. I have read about wikidata but dont know
how to process it like we do DBpedia from Jena?


Re: Problem in saving class instances to file

2016-12-02 Thread kumar rohit
Hello Lorenz, I tried to load the model from one owl file and then stored
it to another file (though both files have same data, but different names).
When I try to load model from owl file and store also into same file, it
then works fine and data is not overwritten.



On Fri, Dec 2, 2016 at 2:00 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

>
> > If you really want to write each user to a separate file
> >
> > I dont want each user to a separate file, rather I want to save all the
> > individuals/students in one file. Some times ago, it worked for me but I
> > have made some changes to my code and now when I enter an individual, it
> > replaces the existing one and hence saves only one at a time.
> >
> > I have checked the model before saving it to a file, and the model
> contains
> > only one individual (replaces existing one), so I think the problem is
> not
> > in the file saving itself.
> As I said, you have to load the existing model from the existing file.
> Then work on this model. Then save this model to disk to the same file.
> >
> >
> >
> > On Fri, Dec 2, 2016 at 12:23 PM, Claude Warren  wrote:
> >
> >> It sounds to me like Kumar is thinking that he needs to store each
> student
> >> in an individual file and load that.  Kumar, if that is the case then I
> >> think you misunderstand how the graph storage works.  Or you have an
> >> unusual use case.  In most cases you would simply write the entire
> graph to
> >> disk (Ususally using TDB as the storage engine as it will handle all the
> >> persistence for you).  If you really want to write each user to a
> separate
> >> file then I would suggest creating a model using the Construct select to
> >> pull all the data about the user and then write that graph to disk using
> >> the standard graph.write() functionality.
> >>
> >> Claude
> >>
> >> On Fri, Dec 2, 2016 at 8:18 AM, Lorenz B. <
> >> buehm...@informatik.uni-leipzig.de> wrote:
> >>
> >>>
>  Hi
>  I want to create student instances of my Student class and enter his
>  details. Then at the end I writes model to the file.
> 
>   OntClass std = model.getOntClass(ns + "Student");
>    Individual mystd = std.createIndividual(ns + stdname);
> 
>  In the file when I enter name of a student, i-e Bob, it saves to the
> >> file
>  along other information like department, address etc.
>  Next time, when I enter another student name, i-e Alice, it replaces
>  previous instances of students and currently only one student is saved
> >> to
>  file.
> 
>  I want record of all students so need all student instances. I used
> for
>  file writing.
> >>> I don't understand the problem. You have to load the existing model and
> >>> add new individuals to it. If you don't open the existing model, indeed
> >>> only what's added to your new model will be saved to the file.
>  try (FileOutputStream write = new FileOutputStream("D://
> >> students.owl"))
> >>> {
> model.write(write, "RDF/XML");
> 
> >>> --
> >>> Lorenz Bühmann
> >>> AKSW group, University of Leipzig
> >>> Group: http://aksw.org - semantic web research center
> >>>
> >>>
> >>
> >> --
> >> I like: Like Like - The likeliest place on the web
> >> 
> >> LinkedIn: http://www.linkedin.com/in/claudewarren
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Problem in saving class instances to file

2016-12-02 Thread kumar rohit
If you really want to write each user to a separate file

I dont want each user to a separate file, rather I want to save all the
individuals/students in one file. Some times ago, it worked for me but I
have made some changes to my code and now when I enter an individual, it
replaces the existing one and hence saves only one at a time.

I have checked the model before saving it to a file, and the model contains
only one individual (replaces existing one), so I think the problem is not
in the file saving itself.



On Fri, Dec 2, 2016 at 12:23 PM, Claude Warren  wrote:

> It sounds to me like Kumar is thinking that he needs to store each student
> in an individual file and load that.  Kumar, if that is the case then I
> think you misunderstand how the graph storage works.  Or you have an
> unusual use case.  In most cases you would simply write the entire graph to
> disk (Ususally using TDB as the storage engine as it will handle all the
> persistence for you).  If you really want to write each user to a separate
> file then I would suggest creating a model using the Construct select to
> pull all the data about the user and then write that graph to disk using
> the standard graph.write() functionality.
>
> Claude
>
> On Fri, Dec 2, 2016 at 8:18 AM, Lorenz B. <
> buehm...@informatik.uni-leipzig.de> wrote:
>
> >
> >
> > > Hi
> > > I want to create student instances of my Student class and enter his
> > > details. Then at the end I writes model to the file.
> > >
> > >  OntClass std = model.getOntClass(ns + "Student");
> > >   Individual mystd = std.createIndividual(ns + stdname);
> > >
> > > In the file when I enter name of a student, i-e Bob, it saves to the
> file
> > > along other information like department, address etc.
> > > Next time, when I enter another student name, i-e Alice, it replaces
> > > previous instances of students and currently only one student is saved
> to
> > > file.
> > >
> > > I want record of all students so need all student instances. I used for
> > > file writing.
> > I don't understand the problem. You have to load the existing model and
> > add new individuals to it. If you don't open the existing model, indeed
> > only what's added to your new model will be saved to the file.
> > > try (FileOutputStream write = new FileOutputStream("D://
> students.owl"))
> > {
> > >model.write(write, "RDF/XML");
> > >
> > --
> > Lorenz Bühmann
> > AKSW group, University of Leipzig
> > Group: http://aksw.org - semantic web research center
> >
> >
>
>
> --
> I like: Like Like - The likeliest place on the web
> 
> LinkedIn: http://www.linkedin.com/in/claudewarren
>


Problem in saving class instances to file

2016-12-01 Thread kumar rohit
Hi
I want to create student instances of my Student class and enter his
details. Then at the end I writes model to the file.

 OntClass std = model.getOntClass(ns + "Student");
  Individual mystd = std.createIndividual(ns + stdname);

In the file when I enter name of a student, i-e Bob, it saves to the file
along other information like department, address etc.
Next time, when I enter another student name, i-e Alice, it replaces
previous instances of students and currently only one student is saved to
file.

I want record of all students so need all student instances. I used for
file writing.

try (FileOutputStream write = new FileOutputStream("D://students.owl")) {
   model.write(write, "RDF/XML");


Two values for a Property

2016-11-21 Thread kumar rohit
 Literal lit1 = model.createTypedLiteral(yes);
 Literal lit2 = model.createTypedLiteral(no);

if (Some condition)
{
individual.setPropertyValue(Participate, lit1);
else
individual.setPropertyValue(Participate, lit2);
}


Is this possible that we have two set of values for a property? I use the
above statements but it gives me error at setting second property

else
individual.setPropertyValue(Participate, lit2);


Re: listResources

2016-11-12 Thread kumar rohit
So it means if we have to get instances of Student, both methods can be
used.?

On Sat, Nov 12, 2016 at 4:15 PM, Claude Warren <cla...@xenei.com> wrote:

> Your statement
>
> model.listResourcesWithProperty(RDF.type, std)
>
> will list all the studen resources in the graph
>
> the statement:
>
> model.listStatements(null,RDF.type, "Student");
>
> will probably list nothing given what I think you have in the graph as you
> probably don't have any statements where the type is the literal "Student".
>
> however:
>
> model.listStatements(null,RDF.type, std);
>
> would list all the statements (triples) that identify users.
>
> In either case your example does not do anything with the result of the
> listStatements() method call, and does not need it to print out the list of
> students.
>
> Claude
>
>
> On Fri, Nov 11, 2016 at 7:56 PM, kumar rohit <kumar.en...@gmail.com>
> wrote:
>
> > Thank you Lorenz.
> >
> > I have  *OntClass std = model.getOntClass(ns + "Student");*
> >
> >   for (Iterator i = model.listResourcesWithProperty(RDF.type, std);
> >  i.hasNext();) {
> >model.listStatements(null,RDF.type, "Student");
> >System.out.println("Student: " + i.next());
> > }
> >
> > I read this on the web, here why we use:   *model.listStatements(null,
> > RDF.type,
> > "Student");*
> >
> > *Because we can get Subjects of the triple already from this
> > statement: *model.listResourcesWithProperty(RDF.type,
> > std);
> >
> >
> > On Fri, Nov 11, 2016 at 11:34 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> > > I assume that you know what resources and properties in RDF graphs are.
> > >
> > > Given the property p, indeed one can check for all triples (s_i, p,
> > > o_j), i.e. all triples that have the property p in predicate position.
> > > The methods:
> > >
> > > listResourcesWithProperty(Property p) returns all resources s_i
> > >
> > > listResourcesWithProperty(Property p, RDFNode o) returns all subjects
> > > s_i that occur in triples in which o_j matches o
> > >
> > >
> > > Lorenz
> > >
> > > > Thank you Chris and Soroka.
> > > >
> > > > I have read this and could not understand it properly, that is why I
> > > asked
> > > > the question here. I will be happy if some one give an example with
> > > > model.listResourcesWithProperty()
> > > > used in it.
> > > >
> > > >
> > > >
> > > > On Thu, Nov 10, 2016 at 5:35 PM, A. Soroka <aj...@virginia.edu>
> wrote:
> > > >
> > > >> https://jena.apache.org/documentation/javadoc/jena/
> > > >> org/apache/jena/rdf/model/Model.html#listResourcesWithProperty-org.
> > > >> apache.jena.rdf.model.Property-
> > > >>
> > > >> Please learn to read Javadocs for software you are using.
> > > >>
> > > >> ---
> > > >> A. Soroka
> > > >> The University of Virginia Library
> > > >>
> > > >>> On Nov 10, 2016, at 10:32 AM, kumar rohit <kumar.en...@gmail.com>
> > > wrote:
> > > >>>
> > > >>> What is mean my model.listResourcesWithProperty()?
> > > >>> What it accepts as parameters and what it returns as output?
> > > >>
> > > --
> > > Lorenz Bühmann
> > > AKSW group, University of Leipzig
> > > Group: http://aksw.org - semantic web research center
> > >
> > >
> >
>
>
>
> --
> I like: Like Like - The likeliest place on the web
> <http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren
>


Re: listResources

2016-11-11 Thread kumar rohit
Thank you Lorenz.

I have  *OntClass std = model.getOntClass(ns + "Student");*

  for (Iterator i = model.listResourcesWithProperty(RDF.type, std);
 i.hasNext();) {
   model.listStatements(null,RDF.type, "Student");
   System.out.println("Student: " + i.next());
}

I read this on the web, here why we use:   *model.listStatements(null,RDF.type,
"Student");*

*Because we can get Subjects of the triple already from this
statement: *model.listResourcesWithProperty(RDF.type,
std);


On Fri, Nov 11, 2016 at 11:34 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> I assume that you know what resources and properties in RDF graphs are.
>
> Given the property p, indeed one can check for all triples (s_i, p,
> o_j), i.e. all triples that have the property p in predicate position.
> The methods:
>
> listResourcesWithProperty(Property p) returns all resources s_i
>
> listResourcesWithProperty(Property p, RDFNode o) returns all subjects
> s_i that occur in triples in which o_j matches o
>
>
> Lorenz
>
> > Thank you Chris and Soroka.
> >
> > I have read this and could not understand it properly, that is why I
> asked
> > the question here. I will be happy if some one give an example with
> > model.listResourcesWithProperty()
> > used in it.
> >
> >
> >
> > On Thu, Nov 10, 2016 at 5:35 PM, A. Soroka <aj...@virginia.edu> wrote:
> >
> >> https://jena.apache.org/documentation/javadoc/jena/
> >> org/apache/jena/rdf/model/Model.html#listResourcesWithProperty-org.
> >> apache.jena.rdf.model.Property-
> >>
> >> Please learn to read Javadocs for software you are using.
> >>
> >> ---
> >> A. Soroka
> >> The University of Virginia Library
> >>
> >>> On Nov 10, 2016, at 10:32 AM, kumar rohit <kumar.en...@gmail.com>
> wrote:
> >>>
> >>> What is mean my model.listResourcesWithProperty()?
> >>> What it accepts as parameters and what it returns as output?
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Filter syntax

2016-11-01 Thread kumar rohit
  + "FILTER ( ?student =' "+name+" ' ) " //name can be any string

   + "FILTER ( ?student , ' "+name+" ' ) "

which syntax is correct? == sign or just comma sign?
And is regex keyword mandatory here? In which situation we should use regex
with Filter keyword?


Rules

2016-10-28 Thread kumar rohit
Hello
I have two to three rules in my java code but the number of rules now
increased and I need to write it in the file and imports it.
I want to ask what changes I need to do inside my code.
Or just write
*Reasoner reasoner = new GenericRuleReasoner( Rule.rulesFromURL( **"rules.t*
xt" ) );

instead of

Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));

Also is it necessary that rules.txt will be in the project folder?


Re: query problem

2016-10-22 Thread kumar rohit
The error is :

Encountered " "(" "( "" at line 1, column 221.
Was expecting one of:
"graph" ...
"optional" ...
"minus" ...
"bind" ...
"service" ...
"filter" ...
"{" ...
"}" ...
";" ...
"," ...
"." ...

On Sat, Oct 22, 2016 at 3:19 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Kumar,
>
> probably missing space between ?result and FILTER. Why don't you print
> the String and show it to us? Nobody wants to read Java concatenated
> String objects.
> > Is the query correct? It gives me error, I think syntax error.
> >
> >   "SELECT  * " +
> > " WHERE {   ?student std:result ?result"
> >+ "FILTER ( ?student =' "+name+" ' ) " +
> >
> >   "}";
> >
> > name is java variable
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


query problem

2016-10-22 Thread kumar rohit
Is the query correct? It gives me error, I think syntax error.

  "SELECT  * " +
" WHERE {   ?student std:result ?result"
   + "FILTER ( ?student =' "+name+" ' ) " +

  "}";

name is java variable


Fetch value from ontology

2016-10-21 Thread kumar rohit
I have student Reg.No and name property.
Reg.No Name
1   Rohit
2   Kumar

Then, if I use as: if (Reg.No==1) OR Reg.No==2
  fetch name of student
In this case, which name value will be extracted from the ontology?
Rohit, kumar, or both?


Re: garbage data stores in owl file

2016-10-08 Thread kumar rohit
Don't write the inference model to disk unless you want all the inferences.
You mean once all the inference or rules done, I write the inference to
disk? Or I have misinterpreted your answer, Dave?

On Sat, Oct 8, 2016 at 10:08 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
wrote:

>
>
> On 08/10/16 11:28, kumar rohit wrote:
>
>> I have added my model to the disk file but it adds some garbage data to my
>> file like Alt, Bag etc.
>>
>> Why this happens? I read the model, did some changes and write the model
>> to
>> disk. (I write the inference model to the disk)
>>
>>
> Don't write the inference model to disk unless you want all the
> inferences. You are probably seeing some of the base facts and initial
> inferences from them that are true in any OWL model.
>
> Dave
>


garbage data stores in owl file

2016-10-08 Thread kumar rohit
I have added my model to the disk file but it adds some garbage data to my
file like Alt, Bag etc.

Why this happens? I read the model, did some changes and write the model to
disk. (I write the inference model to the disk)


Re: Overwrite data of ontology

2016-09-27 Thread kumar rohit
Not typo, my data property in ontology was the same I used in Jena code but
I just made a change in its spelling to check it works or not and luckily
it worked.

On Tue, Sep 27, 2016 at 12:26 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> So it was a typo in the end.
> > Thanks Dave and Lorenz, what I actually did now is just changed the name
> of
> > data property from Item to item, and now it works i-e saved it as data
> > property.
> > Thanks again sir for both of your kind suggestions.
> >
> >
> > On Mon, Sep 26, 2016 at 10:32 AM, Dave Reynolds <
> dave.e.reyno...@gmail.com>
> > wrote:
> >
> >> On 26/09/16 18:26, kumar rohit wrote:
> >>
> >>> May I know why this occurs usually (save data as Annotations)? I wonder
> >>> what mistake I have actually done to encounter this.?
> >>>
> >> You would need to ask the protege folks why they put it there, protege
> is
> >> nothing to do with Jena.
> >>
> >> However, one thing to check is whether you are using the correct URI. If
> >> you have the wrong value in the "ns" variable then you might be adding a
> >> different property than the one you have declared.
> >>
> >> Again, to get help you need to provide a complete, minimal example.
> >>
> >> In this case you need a single generated ontology file with the
> >> DatatypeProperty declaration and the instance with the corresponding
> value
> >> as generated by your Jena code.
> >>
> >> Then if the ontology files looks correct but doesn't show in protege how
> >> you expect then you have something to talk to the protege folks about.
> >>
> >> If the file doesn't look correct then you know there's a problem in your
> >> jena code. In which case, if need help then show a complete, minimal
> >> example of the code that generated the file.
> >>
> >> Dave
> >>
> >>
> >> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <kumar.en...@gmail.com>
> >>> wrote:
> >>>
> >>> Hello Dave, I have Item as data type property in my Protege ontology.
> >>>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
> >>>> dave.e.reyno...@gmail.com>
> >>>> wrote:
> >>>>
> >>>> On 26/09/16 16:59, kumar rohit wrote:
> >>>>> I have already tried this:
> >>>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
> >>>>>>
> >>>>>>
> >>>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
> >>>>> your ontology then you'll need model.createDatatypeProperty so as to
> >>>>> side-effect the model to include the declaration of Item.
> >>>>>
> >>>>> Dave
> >>>>>
> >>>>>
> >>>>>  Literal value = model.createTypedLiteral(Some value);
> >>>>>
> >>>>>>  customer.setPropertyValue(item, value);
> >>>>>>
> >>>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
> >>>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>>
> >>>>>> Please try to use the Apache Jena documentations first, most things
> are
> >>>>>>
> >>>>>>> pretty much explained there [1]
> >>>>>>>
> >>>>>>> I am sorry my problem still exists and some values are stored as
> data
> >>>>>>>> property and some still as "Annotations" though I used the same
> >>>>>>>> procedure
> >>>>>>>> for all.
> >>>>>>>>
> >>>>>>>> OntResource res=model.createOntResource(ns+ value); //value come
> >>>>>>>> from
> >>>>>>>>
> >>>>>>>> java
> >>>>>>> variable
> >>>>>>>>  OntProperty price= model.getOntProperty(ns+"ItemPrice");
> >>>>>>>>
> >>>>>>>> I don't understand why you still do not use a typed OWL property
> >>>>>>> here,
> >>>>>>> as I said in my previous answer?...
> >>>>>>> OWL has object property and data property, thus, why don't you call
> >>>>>>>
> >>>>>&g

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
So it means we have to use DatatypeProperty, ObjecttypeProperty instead of
just Property etc?
I still confuse, if we used OntModel, we should use DatatypeProperty or
OntProperty?

On Mon, Sep 26, 2016 at 12:19 PM, Lorenz Buehmann <
buehm...@informatik.uni-leipzig.de> wrote:

> Nothing is "saved as annotations". Without using explicit OWL types, the
> OWL API - which is quite strict -
>
> is not able to determine the type of a property, thus, it's treated as
> annotation property. and according to the OWL 2 specs, entities have to
> be typed explicitly.
>
>
> On 26.09.2016 19:26, kumar rohit wrote:
> > May I know why this occurs usually (save data as Annotations)? I wonder
> > what mistake I have actually done to encounter this.?
> >
> >
> > On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <kumar.en...@gmail.com>
> wrote:
> >
> >> Hello Dave, I have Item as data type property in my Protege ontology.
> >>
> >> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
> dave.e.reyno...@gmail.com>
> >> wrote:
> >>
> >>> On 26/09/16 16:59, kumar rohit wrote:
> >>>
> >>>> I have already tried this:
> >>>>
> >>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
> >>>>
> >>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
> >>> your ontology then you'll need model.createDatatypeProperty so as to
> >>> side-effect the model to include the declaration of Item.
> >>>
> >>> Dave
> >>>
> >>>
> >>>  Literal value = model.createTypedLiteral(Some value);
> >>>>  customer.setPropertyValue(item, value);
> >>>>
> >>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
> >>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>
> >>>> Please try to use the Apache Jena documentations first, most things
> are
> >>>>> pretty much explained there [1]
> >>>>>
> >>>>>> I am sorry my problem still exists and some values are stored as
> data
> >>>>>> property and some still as "Annotations" though I used the same
> >>>>>> procedure
> >>>>>> for all.
> >>>>>>
> >>>>>> OntResource res=model.createOntResource(ns+ value); //value come
> from
> >>>>>>
> >>>>> java
> >>>>>
> >>>>>> variable
> >>>>>>
> >>>>>>  OntProperty price= model.getOntProperty(ns+"ItemPrice");
> >>>>>>
> >>>>> I don't understand why you still do not use a typed OWL property
> here,
> >>>>> as I said in my previous answer?...
> >>>>> OWL has object property and data property, thus, why don't you call
> >>>>>
> >>>>> model.getDatatypeProperty(ns+"ItemPrice")
> >>>>>
> >>>>> For object properties the same:
> >>>>> model.getObjectProperty(String uri)
> >>>>>
> >>>>> [1] https://jena.apache.org/documentation/ontology/#
> ontology-properties
> >>>>>
> >>>>>> customer.setPropertyValue(price, res);
> >>>>>>
> >>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> >>>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>>
> >>>>>> Yes, in that case it is supposed to be an RDF property, thus not
> typed
> >>>>>>> as expected to be in an OWL ontology.
> >>>>>>>
> >>>>>>>> I used OntModel as model to read the ontology but used Property
> >>>>>>>> instead
> >>>>>>>>
> >>>>>>> of
> >>>>>>>
> >>>>>>>> OntProperty, is this an issue?
> >>>>>>>>
> >>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> >>>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>>>>
> >>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
> >>>>>>>>> parser will treat it as OWL annotation property. This has to be
> >>>>>>>>> explicitly declared in the ontology, the ea

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
Thanks Dave and Lorenz, what I actually did now is just changed the name of
data property from Item to item, and now it works i-e saved it as data
property.
Thanks again sir for both of your kind suggestions.


On Mon, Sep 26, 2016 at 10:32 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
wrote:

> On 26/09/16 18:26, kumar rohit wrote:
>
>> May I know why this occurs usually (save data as Annotations)? I wonder
>> what mistake I have actually done to encounter this.?
>>
>
> You would need to ask the protege folks why they put it there, protege is
> nothing to do with Jena.
>
> However, one thing to check is whether you are using the correct URI. If
> you have the wrong value in the "ns" variable then you might be adding a
> different property than the one you have declared.
>
> Again, to get help you need to provide a complete, minimal example.
>
> In this case you need a single generated ontology file with the
> DatatypeProperty declaration and the instance with the corresponding value
> as generated by your Jena code.
>
> Then if the ontology files looks correct but doesn't show in protege how
> you expect then you have something to talk to the protege folks about.
>
> If the file doesn't look correct then you know there's a problem in your
> jena code. In which case, if need help then show a complete, minimal
> example of the code that generated the file.
>
> Dave
>
>
> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <kumar.en...@gmail.com>
>> wrote:
>>
>> Hello Dave, I have Item as data type property in my Protege ontology.
>>>
>>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
>>> dave.e.reyno...@gmail.com>
>>> wrote:
>>>
>>> On 26/09/16 16:59, kumar rohit wrote:
>>>>
>>>> I have already tried this:
>>>>>
>>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>>>
>>>>>
>>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>>>> your ontology then you'll need model.createDatatypeProperty so as to
>>>> side-effect the model to include the declaration of Item.
>>>>
>>>> Dave
>>>>
>>>>
>>>>  Literal value = model.createTypedLiteral(Some value);
>>>>
>>>>>
>>>>>  customer.setPropertyValue(item, value);
>>>>>
>>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>> Please try to use the Apache Jena documentations first, most things are
>>>>>
>>>>>> pretty much explained there [1]
>>>>>>
>>>>>> I am sorry my problem still exists and some values are stored as data
>>>>>>> property and some still as "Annotations" though I used the same
>>>>>>> procedure
>>>>>>> for all.
>>>>>>>
>>>>>>> OntResource res=model.createOntResource(ns+ value); //value come
>>>>>>> from
>>>>>>>
>>>>>>> java
>>>>>>
>>>>>> variable
>>>>>>>
>>>>>>>  OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>>>
>>>>>>> I don't understand why you still do not use a typed OWL property
>>>>>> here,
>>>>>> as I said in my previous answer?...
>>>>>> OWL has object property and data property, thus, why don't you call
>>>>>>
>>>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>>>
>>>>>> For object properties the same:
>>>>>> model.getObjectProperty(String uri)
>>>>>>
>>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-
>>>>>> properties
>>>>>>
>>>>>> customer.setPropertyValue(price, res);
>>>>>>>
>>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>> Yes, in that case it is supposed to be an RDF property, thus not
>>>>>>> typed
>>>>>>>
>>>>>>>> as expected to be in an OWL ontology.
>>>>>>>>
>>>>>>>> I used OntModel a

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
May I know why this occurs usually (save data as Annotations)? I wonder
what mistake I have actually done to encounter this.?


On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <kumar.en...@gmail.com> wrote:

> Hello Dave, I have Item as data type property in my Protege ontology.
>
> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
> wrote:
>
>> On 26/09/16 16:59, kumar rohit wrote:
>>
>>> I have already tried this:
>>>
>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>
>>
>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>> your ontology then you'll need model.createDatatypeProperty so as to
>> side-effect the model to include the declaration of Item.
>>
>> Dave
>>
>>
>>  Literal value = model.createTypedLiteral(Some value);
>>>
>>>  customer.setPropertyValue(item, value);
>>>
>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>
>>> Please try to use the Apache Jena documentations first, most things are
>>>> pretty much explained there [1]
>>>>
>>>>> I am sorry my problem still exists and some values are stored as data
>>>>> property and some still as "Annotations" though I used the same
>>>>> procedure
>>>>> for all.
>>>>>
>>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>>
>>>> java
>>>>
>>>>> variable
>>>>>
>>>>>  OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>
>>>> I don't understand why you still do not use a typed OWL property here,
>>>> as I said in my previous answer?...
>>>> OWL has object property and data property, thus, why don't you call
>>>>
>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>
>>>> For object properties the same:
>>>> model.getObjectProperty(String uri)
>>>>
>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>>
>>>>> customer.setPropertyValue(price, res);
>>>>>
>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>>> as expected to be in an OWL ontology.
>>>>>>
>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>> instead
>>>>>>>
>>>>>> of
>>>>>>
>>>>>>> OntProperty, is this an issue?
>>>>>>>
>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>> be
>>>>>>>>
>>>>>>> to
>>>>
>>>>> use an OntModel
>>>>>>>>
>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>>
>>>>>>>> the
>>>>
>>>>> Annotations tab rather than in the data property.
>>>>>>>>>
>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>
>>>>>>>>> I want to write as data property values.
>>>>>>>>>
>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>>>>>
>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>>
>>>>>>>>> like
>>>>>>
>>>>>>> to try a shot in the dark.
>>>>>>>>>>
>>>>>>>&

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
Hello Dave, I have Item as data type property in my Protege ontology.

On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
wrote:

> On 26/09/16 16:59, kumar rohit wrote:
>
>> I have already tried this:
>>
>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>
>
> If the URI ns+"Item" is not already declared as a DatatypeProperty in your
> ontology then you'll need model.createDatatypeProperty so as to side-effect
> the model to include the declaration of Item.
>
> Dave
>
>
>  Literal value = model.createTypedLiteral(Some value);
>>
>>  customer.setPropertyValue(item, value);
>>
>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>> buehm...@informatik.uni-leipzig.de> wrote:
>>
>> Please try to use the Apache Jena documentations first, most things are
>>> pretty much explained there [1]
>>>
>>>> I am sorry my problem still exists and some values are stored as data
>>>> property and some still as "Annotations" though I used the same
>>>> procedure
>>>> for all.
>>>>
>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>
>>> java
>>>
>>>> variable
>>>>
>>>>  OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>
>>> I don't understand why you still do not use a typed OWL property here,
>>> as I said in my previous answer?...
>>> OWL has object property and data property, thus, why don't you call
>>>
>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>
>>> For object properties the same:
>>> model.getObjectProperty(String uri)
>>>
>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>
>>>> customer.setPropertyValue(price, res);
>>>>
>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>
>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>> as expected to be in an OWL ontology.
>>>>>
>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>> instead
>>>>>>
>>>>> of
>>>>>
>>>>>> OntProperty, is this an issue?
>>>>>>
>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>>
>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>> explicitly declared in the ontology, the easiest way in Jena would be
>>>>>>>
>>>>>> to
>>>
>>>> use an OntModel
>>>>>>>
>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>
>>>>>>> the
>>>
>>>> Annotations tab rather than in the data property.
>>>>>>>>
>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>
>>>>>>>> I want to write as data property values.
>>>>>>>>
>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>>>>
>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>
>>>>>>>> like
>>>>>
>>>>>> to try a shot in the dark.
>>>>>>>>>
>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>
>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>
>>>>>>>>> overwritten
>>>
>>>> and
>>>>>>>
>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>
>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
I have already tried this:

DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
 Literal value = model.createTypedLiteral(Some value);

 customer.setPropertyValue(item, value);

On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
buehm...@informatik.uni-leipzig.de> wrote:

> Please try to use the Apache Jena documentations first, most things are
> pretty much explained there [1]
> > I am sorry my problem still exists and some values are stored as data
> > property and some still as "Annotations" though I used the same procedure
> > for all.
> >
> > OntResource res=model.createOntResource(ns+ value); //value come from
> java
> > variable
> >
> >  OntProperty price= model.getOntProperty(ns+"ItemPrice");
> I don't understand why you still do not use a typed OWL property here,
> as I said in my previous answer?...
> OWL has object property and data property, thus, why don't you call
>
> model.getDatatypeProperty(ns+"ItemPrice")
>
> For object properties the same:
> model.getObjectProperty(String uri)
>
> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
> > customer.setPropertyValue(price, res);
> >
> > On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> Yes, in that case it is supposed to be an RDF property, thus not typed
> >> as expected to be in an OWL ontology.
> >>> I used OntModel as model to read the ontology but used Property instead
> >> of
> >>> OntProperty, is this an issue?
> >>>
> >>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> >>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> For Protege it MUST be an OWL data property, otherwise the OWL API
> >>>> parser will treat it as OWL annotation property. This has to be
> >>>> explicitly declared in the ontology, the easiest way in Jena would be
> to
> >>>> use an OntModel
> >>>>
> >>>>> Yes Lorenz sir I have written it to disk but it writes the data in
> the
> >>>>> Annotations tab rather than in the data property.
> >>>>>
> >>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>
> >>>>> I want to write as data property values.
> >>>>>
> >>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>
> >>>>>> Ehm, did you write the model to disk? Without seeing any code it's
> >> like
> >>>>>> to try a shot in the dark.
> >>>>>>
> >>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>
> >>>>>>> Next time after login as Customer1, previous data has not
> overwritten
> >>>> and
> >>>>>>> the owl file shows me old data also..
> >>>>>>>
> >>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>>>
> >>>>>>>> Please learn to read the Javadoc [1] if you're programming in
> >> Java...
> >>>>>>>> And using an IDE would also help, usually this is able to show you
> >> the
> >>>>>>>> arguments and it's expected types.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> [1]
> >>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>>>
> >>>>>>>>> I used this:  customer.setPropertyValue(property,
> pricevariable);
> >>>>>>>>>
> >>>>>>>>> property here is property name:Item price and pricevariable is
> int
> >>>>>> value
> >>>>>>>>> but it gives me error of :
> >>>>>>>>>
> >>>>>>>>> *int can not be converted to RDF Node*
> >>>>>>>>>
> >>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>>>> d

Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
I am sorry my problem still exists and some values are stored as data
property and some still as "Annotations" though I used the same procedure
for all.

OntResource res=model.createOntResource(ns+ value); //value come from java
variable

 OntProperty price= model.getOntProperty(ns+"ItemPrice");
customer.setPropertyValue(price, res);

On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Yes, in that case it is supposed to be an RDF property, thus not typed
> as expected to be in an OWL ontology.
> > I used OntModel as model to read the ontology but used Property instead
> of
> > OntProperty, is this an issue?
> >
> > On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> For Protege it MUST be an OWL data property, otherwise the OWL API
> >> parser will treat it as OWL annotation property. This has to be
> >> explicitly declared in the ontology, the easiest way in Jena would be to
> >> use an OntModel
> >>
> >>> Yes Lorenz sir I have written it to disk but it writes the data in the
> >>> Annotations tab rather than in the data property.
> >>>
> >>> Customer1.setPropertyValue(price, pricevalue);
> >>> Customer1.setPropertyValue(quantity, value);
> >>>
> >>> I want to write as data property values.
> >>>
> >>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> Ehm, did you write the model to disk? Without seeing any code it's
> like
> >>>> to try a shot in the dark.
> >>>>
> >>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>
> >>>>> Next time after login as Customer1, previous data has not overwritten
> >> and
> >>>>> the owl file shows me old data also..
> >>>>>
> >>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>>>
> >>>>>> Please learn to read the Javadoc [1] if you're programming in
> Java...
> >>>>>>
> >>>>>> And using an IDE would also help, usually this is able to show you
> the
> >>>>>> arguments and it's expected types.
> >>>>>>
> >>>>>>
> >>>>>> [1]
> >>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>
> >>>>>>> I used this:  customer.setPropertyValue(property, pricevariable);
> >>>>>>>
> >>>>>>> property here is property name:Item price and pricevariable is int
> >>>> value
> >>>>>>> but it gives me error of :
> >>>>>>>
> >>>>>>> *int can not be converted to RDF Node*
> >>>>>>>
> >>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>> dave.e.reyno...@gmail.com>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>>>
> >>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
> >> this
> >>>>>>>>>  Property property=model.getProperty(name space+ "Item price");
> >>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>>>> Now how to remove previously entered values? Any built-in
> methods?
> >>>>>>>>>
> >>>>>>>> Read my message again, I gave you the name of a method that does
> the
> >>>>>>>> replacement (= remove + add) in one go.
> >>>>>>>>
> >>>>>>>> The javadoc and documentation tutorials will help you find the
> many
> >>>>>> remove
> >>>>>>>> methods that are available.
> >>>>>>>>
> >>>>>>>> Dave
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> >>>> wrote:
> >>>>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>>>> ---
> >>>>>>>>>> A. Soroka
> >>>>>>>>>> The University of Virginia Library
> >>>>>>>>>>
> >>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com
> >
> >>>>>> wrote:
> >>>>>>>>>>> I want to save item price entered by users in file. Samsung
> >> Galaxy
> >>>>>>>>>> hasPrice
> >>>>>>>>>>
> >>>>>>>>>>> ?value.
> >>>>>>>>>>> User enter some value and it is stored in the file. After some
> >>>> time,
> >>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
> >> stored.
> >>>>>> But
> >>>>>>>>>> the
> >>>>>>>>>>
> >>>>>>>>>>> problem is that the old price is also there.
> >>>>>>>>>>> How can I overwrite the previous values with recently entered
> >> value
> >>>>>> so
> >>>>>>>>>> that
> >>>>>>>>>>
> >>>>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>>>
> >>>>>> --
> >>>>>> Lorenz Bühmann
> >>>>>> AKSW group, University of Leipzig
> >>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>
> >>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
I used OntModel as model to read the ontology but used Property instead of
OntProperty, is this an issue?

On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> For Protege it MUST be an OWL data property, otherwise the OWL API
> parser will treat it as OWL annotation property. This has to be
> explicitly declared in the ontology, the easiest way in Jena would be to
> use an OntModel
>
> > Yes Lorenz sir I have written it to disk but it writes the data in the
> > Annotations tab rather than in the data property.
> >
> > Customer1.setPropertyValue(price, pricevalue);
> > Customer1.setPropertyValue(quantity, value);
> >
> > I want to write as data property values.
> >
> > On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> Ehm, did you write the model to disk? Without seeing any code it's like
> >> to try a shot in the dark.
> >>
> >>> Customer1.setPropertyValue(price, pricevalue);
> >>> Customer1.setPropertyValue(quantity, value);
> >>>
> >>> Next time after login as Customer1, previous data has not overwritten
> and
> >>> the owl file shows me old data also..
> >>>
> >>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> Please learn to read the Javadoc [1] if you're programming in Java...
> >>>>
> >>>> And using an IDE would also help, usually this is able to show you the
> >>>> arguments and it's expected types.
> >>>>
> >>>>
> >>>> [1]
> >>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>> org/apache/jena/ontology/OntResource.html
> >>>>
> >>>>> I used this:  customer.setPropertyValue(property, pricevariable);
> >>>>>
> >>>>> property here is property name:Item price and pricevariable is int
> >> value
> >>>>> but it gives me error of :
> >>>>>
> >>>>> *int can not be converted to RDF Node*
> >>>>>
> >>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>> dave.e.reyno...@gmail.com>
> >>>>> wrote:
> >>>>>
> >>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>
> >>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
> this
> >>>>>>>
> >>>>>>>  Property property=model.getProperty(name space+ "Item price");
> >>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>> Now how to remove previously entered values? Any built-in methods?
> >>>>>>>
> >>>>>> Read my message again, I gave you the name of a method that does the
> >>>>>> replacement (= remove + add) in one go.
> >>>>>>
> >>>>>> The javadoc and documentation tutorials will help you find the many
> >>>> remove
> >>>>>> methods that are available.
> >>>>>>
> >>>>>> Dave
> >>>>>>
> >>>>>>
> >>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> >> wrote:
> >>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>> ---
> >>>>>>>> A. Soroka
> >>>>>>>> The University of Virginia Library
> >>>>>>>>
> >>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com>
> >>>> wrote:
> >>>>>>>>> I want to save item price entered by users in file. Samsung
> Galaxy
> >>>>>>>>>
> >>>>>>>> hasPrice
> >>>>>>>>
> >>>>>>>>> ?value.
> >>>>>>>>> User enter some value and it is stored in the file. After some
> >> time,
> >>>>>>>>> another price for same Samsung Galaxy is entered and it is
> stored.
> >>>> But
> >>>>>>>> the
> >>>>>>>>
> >>>>>>>>> problem is that the old price is also there.
> >>>>>>>>> How can I overwrite the previous values with recently entered
> value
> >>>> so
> >>>>>>>> that
> >>>>>>>>
> >>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Overwrite data of ontology

2016-09-26 Thread kumar rohit
Yes Lorenz sir I have written it to disk but it writes the data in the
Annotations tab rather than in the data property.

Customer1.setPropertyValue(price, pricevalue);
Customer1.setPropertyValue(quantity, value);

I want to write as data property values.

On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Ehm, did you write the model to disk? Without seeing any code it's like
> to try a shot in the dark.
>
> > Customer1.setPropertyValue(price, pricevalue);
> > Customer1.setPropertyValue(quantity, value);
> >
> > Next time after login as Customer1, previous data has not overwritten and
> > the owl file shows me old data also..
> >
> > On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> Please learn to read the Javadoc [1] if you're programming in Java...
> >>
> >> And using an IDE would also help, usually this is able to show you the
> >> arguments and it's expected types.
> >>
> >>
> >> [1]
> >> https://jena.apache.org/documentation/javadoc/jena/
> >> org/apache/jena/ontology/OntResource.html
> >>
> >>> I used this:  customer.setPropertyValue(property, pricevariable);
> >>>
> >>> property here is property name:Item price and pricevariable is int
> value
> >>> but it gives me error of :
> >>>
> >>> *int can not be converted to RDF Node*
> >>>
> >>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >> dave.e.reyno...@gmail.com>
> >>> wrote:
> >>>
> >>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>
> >>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
> >>>>>
> >>>>>  Property property=model.getProperty(name space+ "Item price");
> >>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>> Now how to remove previously entered values? Any built-in methods?
> >>>>>
> >>>> Read my message again, I gave you the name of a method that does the
> >>>> replacement (= remove + add) in one go.
> >>>>
> >>>> The javadoc and documentation tutorials will help you find the many
> >> remove
> >>>> methods that are available.
> >>>>
> >>>> Dave
> >>>>
> >>>>
> >>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> wrote:
> >>>>> Remove the old triple and add a new one with the new value.
> >>>>>> ---
> >>>>>> A. Soroka
> >>>>>> The University of Virginia Library
> >>>>>>
> >>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com>
> >> wrote:
> >>>>>>> I want to save item price entered by users in file. Samsung Galaxy
> >>>>>>>
> >>>>>> hasPrice
> >>>>>>
> >>>>>>> ?value.
> >>>>>>> User enter some value and it is stored in the file. After some
> time,
> >>>>>>> another price for same Samsung Galaxy is entered and it is stored.
> >> But
> >>>>>> the
> >>>>>>
> >>>>>>> problem is that the old price is also there.
> >>>>>>> How can I overwrite the previous values with recently entered value
> >> so
> >>>>>> that
> >>>>>>
> >>>>>>> my ontology save and shows one value at a time.
> >>>>>>>
> >>>>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Overwrite data of ontology

2016-09-25 Thread kumar rohit
Customer1.setPropertyValue(price, pricevalue);
Customer1.setPropertyValue(quantity, value);

Next time after login as Customer1, previous data has not overwritten and
the owl file shows me old data also..

On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Please learn to read the Javadoc [1] if you're programming in Java...
>
> And using an IDE would also help, usually this is able to show you the
> arguments and it's expected types.
>
>
> [1]
> https://jena.apache.org/documentation/javadoc/jena/
> org/apache/jena/ontology/OntResource.html
>
> > I used this:  customer.setPropertyValue(property, pricevariable);
> >
> > property here is property name:Item price and pricevariable is int value
> > but it gives me error of :
> >
> > *int can not be converted to RDF Node*
> >
> > On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> dave.e.reyno...@gmail.com>
> > wrote:
> >
> >> On 24/09/16 15:37, kumar rohit wrote:
> >>
> >>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
> >>>
> >>>  Property property=model.getProperty(name space+ "Item price");
> >>> and then customer_1.addLiteral(property, Text Field value);
> >>> Now how to remove previously entered values? Any built-in methods?
> >>>
> >> Read my message again, I gave you the name of a method that does the
> >> replacement (= remove + add) in one go.
> >>
> >> The javadoc and documentation tutorials will help you find the many
> remove
> >> methods that are available.
> >>
> >> Dave
> >>
> >>
> >> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
> >>> Remove the old triple and add a new one with the new value.
> >>>> ---
> >>>> A. Soroka
> >>>> The University of Virginia Library
> >>>>
> >>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com>
> wrote:
> >>>>> I want to save item price entered by users in file. Samsung Galaxy
> >>>>>
> >>>> hasPrice
> >>>>
> >>>>> ?value.
> >>>>> User enter some value and it is stored in the file. After some time,
> >>>>> another price for same Samsung Galaxy is entered and it is stored.
> But
> >>>>>
> >>>> the
> >>>>
> >>>>> problem is that the old price is also there.
> >>>>> How can I overwrite the previous values with recently entered value
> so
> >>>>>
> >>>> that
> >>>>
> >>>>> my ontology save and shows one value at a time.
> >>>>>
> >>>>
> >>>>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Overwrite data of ontology

2016-09-24 Thread kumar rohit
I used this:  customer.setPropertyValue(property, pricevariable);

property here is property name:Item price and pricevariable is int value
but it gives me error of :

*int can not be converted to RDF Node*

On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
wrote:

> On 24/09/16 15:37, kumar rohit wrote:
>
>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>
>>  Property property=model.getProperty(name space+ "Item price");
>> and then customer_1.addLiteral(property, Text Field value);
>> Now how to remove previously entered values? Any built-in methods?
>>
>
> Read my message again, I gave you the name of a method that does the
> replacement (= remove + add) in one go.
>
> The javadoc and documentation tutorials will help you find the many remove
> methods that are available.
>
> Dave
>
>
> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
>>
>> Remove the old triple and add a new one with the new value.
>>>
>>> ---
>>> A. Soroka
>>> The University of Virginia Library
>>>
>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com> wrote:
>>>>
>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>
>>> hasPrice
>>>
>>>> ?value.
>>>> User enter some value and it is stored in the file. After some time,
>>>> another price for same Samsung Galaxy is entered and it is stored. But
>>>>
>>> the
>>>
>>>> problem is that the old price is also there.
>>>> How can I overwrite the previous values with recently entered value so
>>>>
>>> that
>>>
>>>> my ontology save and shows one value at a time.
>>>>
>>>
>>>
>>>
>>
>


Re: Overwrite data of ontology

2016-09-24 Thread kumar rohit
Thanks Soroka and Dave, but how I can do it dynamically? I used this

 Property property=model.getProperty(name space+ "Item price");
and then customer_1.addLiteral(property, Text Field value);
Now how to remove previously entered values? Any built-in methods?

On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:

> Remove the old triple and add a new one with the new value.
>
> ---
> A. Soroka
> The University of Virginia Library
>
> > On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.en...@gmail.com> wrote:
> >
> > I want to save item price entered by users in file. Samsung Galaxy
> hasPrice
> > ?value.
> > User enter some value and it is stored in the file. After some time,
> > another price for same Samsung Galaxy is entered and it is stored. But
> the
> > problem is that the old price is also there.
> > How can I overwrite the previous values with recently entered value so
> that
> > my ontology save and shows one value at a time.
>
>


Overwrite data of ontology

2016-09-24 Thread kumar rohit
I want to save item price entered by users in file. Samsung Galaxy hasPrice
?value.
User enter some value and it is stored in the file. After some time,
another price for same Samsung Galaxy is entered and it is stored. But the
problem is that the old price is also there.
How can I overwrite the previous values with recently entered value so that
my ontology save and shows one value at a time.


breaking of QuerySolution to S.P.O

2016-08-04 Thread kumar rohit
After  this code,
QuerySolution soln = results.nextSolution();

how can I get subject, predicate and object of a triple in resultset?

Can we do it in QuerySoloution?


Re: Can not write to the file

2016-07-22 Thread kumar rohit
I dont know if attaching screen shot is allowed or not, but kindly if you
can check it.

After running the code , it has added the garbage classes to the file. User
class is also there as I have created it, but again it has  disappeared my
classes in ontology.

*Note:* I have added new class in the same file I have read it and used the
same namespace of the ontology for new class (User class).
My ontology uri is : *String
ns="http://www.semanticweb.org/ontologies/2016/7/untitled-54/
<http://www.semanticweb.org/ontologies/2016/7/untitled-54/>";*

And I used this for *User* class also.

On Fri, Jul 22, 2016 at 2:47 AM, Dave Reynolds <dave.e.reyno...@gmail.com>
wrote:

> On 22/07/16 10:44, kumar rohit wrote:
>
>> Yes because the model.write() works but the FileWriter does not. I also
>> tried something like this to append data but failed:
>>
>> FileOutputStream f1=new FileOutputStream(file, *true*);
>>
>> Any solution please you suggest to write it to the same file I have read
>> from?
>>
>
> You can't, at least not in RDF/XML format.
>
> As Lorenz says, you would have to read in the current file, add your new
> assertions, then write out the whole file again.
>
>
> Dave
>
> On Fri, Jul 22, 2016 at 2:22 AM, Lorenz B. <
>> buehm...@informatik.uni-leipzig.de> wrote:
>>
>> Hello Dave,
>>>
>>> I think the problem is that he writes to another file - and I guess this
>>> one already contains some data. Of course the write method cannot append
>>> data, but just overwrites the file. Am I right? Anything else would
>>> sound like some magic.
>>>
>>> Otherwise, to append data, one would have to load it into a separate
>>> model and add data directly to this model.
>>>
>>>
>>>
>>> Kind regards,
>>> Lorenz
>>>
>>> On 22/07/16 09:58, kumar rohit wrote:
>>>>
>>>>> The main() pass the required file and then just the GUI loads because
>>>>> we
>>>>> have to deal with a text field where user enter his name and we will
>>>>> create
>>>>> individual of that name.
>>>>>
>>>>> The main purpose of this code is to create individual (after user
>>>>> enter the
>>>>> name) and store it locally in a file *(either a separate file or to the
>>>>> file we have read  **InputStream in =FileManager.get().open(file);*)
>>>>>
>>>>> It writes the required result to the console(model.write method) but
>>>>> when I
>>>>> try to write it in a file, it just remove all the data from the
>>>>> destination
>>>>> file and even the ontology URI.
>>>>>
>>>>> For writing to a file, I used these both methods but both does not
>>>>> work.
>>>>>
>>>>> (1)   FileWriter out = new FileWriter( fileName );
>>>>>
>>>>> try {
>>>>>   model.write( out, "RDF/XML-ABBREV" );}
>>>>>
>>>>> 2)   FileOutputStream out=new FileOutputStream(filename);
>>>>>  RDFWriter d = model.getWriter("RDF/XML-ABBREV");
>>>>>  d.write(model,out,null);
>>>>>  }catch(Exception e) {}
>>>>>
>>>>
>>>>
>>>> Make sure you close the stream, that's probably the source of your
>>>> random loss of output.
>>>>
>>>> The reason you see Seq and other such junk is because you are writing
>>>> the whole model, with inference, and a default OntModel includes RDFS
>>>> inference. Use model.write which for an OntModel defaults to writing
>>>> just the base model. Also, unless you need inference use an explicit
>>>> OntModelSpec which doesn't have any (e.g. OWL_MEM).
>>>>
>>>> Dave
>>>>
>>>> On Fri, Jul 22, 2016 at 12:30 AM, Lorenz B. <
>>>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>> 1.) This is not a minimal running example! that means, nobody can test
>>>>>> it without some (in your case too much) effort to get it running.
>>>>>> 2.) w.r.t. 1), look at your main() method, it reads a file and then?
>>>>>> 2.) Please tell us exactly WHAT does not work and WHAT you expect.
>>>>>> 3.) The OntModel object has a method write, not sure what you did
>>>>>> there
>>>>>> with calling

Re: Can not write to the file

2016-07-22 Thread kumar rohit
Yes because the model.write() works but the FileWriter does not. I also
tried something like this to append data but failed:

FileOutputStream f1=new FileOutputStream(file, *true*);

Any solution please you suggest to write it to the same file I have read
from?



On Fri, Jul 22, 2016 at 2:22 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Hello Dave,
>
> I think the problem is that he writes to another file - and I guess this
> one already contains some data. Of course the write method cannot append
> data, but just overwrites the file. Am I right? Anything else would
> sound like some magic.
>
> Otherwise, to append data, one would have to load it into a separate
> model and add data directly to this model.
>
>
>
> Kind regards,
> Lorenz
>
> > On 22/07/16 09:58, kumar rohit wrote:
> >> The main() pass the required file and then just the GUI loads because we
> >> have to deal with a text field where user enter his name and we will
> >> create
> >> individual of that name.
> >>
> >> The main purpose of this code is to create individual (after user
> >> enter the
> >> name) and store it locally in a file *(either a separate file or to the
> >> file we have read  **InputStream in =FileManager.get().open(file);*)
> >>
> >> It writes the required result to the console(model.write method) but
> >> when I
> >> try to write it in a file, it just remove all the data from the
> >> destination
> >> file and even the ontology URI.
> >>
> >> For writing to a file, I used these both methods but both does not work.
> >>
> >> (1)   FileWriter out = new FileWriter( fileName );
> >>
> >> try {
> >>  model.write( out, "RDF/XML-ABBREV" );}
> >>
> >> 2)   FileOutputStream out=new FileOutputStream(filename);
> >> RDFWriter d = model.getWriter("RDF/XML-ABBREV");
> >> d.write(model,out,null);
> >> }catch(Exception e) {}
> >
> >
> > Make sure you close the stream, that's probably the source of your
> > random loss of output.
> >
> > The reason you see Seq and other such junk is because you are writing
> > the whole model, with inference, and a default OntModel includes RDFS
> > inference. Use model.write which for an OntModel defaults to writing
> > just the base model. Also, unless you need inference use an explicit
> > OntModelSpec which doesn't have any (e.g. OWL_MEM).
> >
> > Dave
> >
> >> On Fri, Jul 22, 2016 at 12:30 AM, Lorenz B. <
> >> buehm...@informatik.uni-leipzig.de> wrote:
> >>
> >>> 1.) This is not a minimal running example! that means, nobody can test
> >>> it without some (in your case too much) effort to get it running.
> >>> 2.) w.r.t. 1), look at your main() method, it reads a file and then?
> >>> 2.) Please tell us exactly WHAT does not work and WHAT you expect.
> >>> 3.) The OntModel object has a method write, not sure what you did there
> >>> with calling getWriter and the like
> >>>
> >>>> *When I run this program without writing it to the file, it runs
> >>> smoothly.
> >>>> But when I copy it to a file (both newly created and existing file),
> >>>> sometime it adds the garbage claases to the file like Seq, Bag,
> >>>> Resource
> >>>> and most of the time it does nothing except it empties the destination
> >>>> file.*
> >>>>
> >>>> *I have copied the whole code except the code auto generated by
> >>>> netbeans*
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> *public class NewJFrame extends javax.swing.JFrame {*
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> *public static void readOntology(String file,OntModel model)*
> >>>>
> >>>> *{*
> >>>>
> >>>>
> >>>> *InputStream in =FileManager.get().open(file);*
> >>>>
> >>>>
> >>>>
> >>>> *if (in==null) {*
> >>>>
> >>>> *throw new IllegalArgumentException( "File: " + file + " not
> >>>> found");*
> >>>>
> >>>> *}*
> >>>>
> >>>> * model.read(in,null);*
> >>>>
> >>>> * //

Re: Can not write to the file

2016-07-22 Thread kumar rohit
The main() pass the required file and then just the GUI loads because we
have to deal with a text field where user enter his name and we will create
individual of that name.

The main purpose of this code is to create individual (after user enter the
name) and store it locally in a file *(either a separate file or to the
file we have read  **InputStream in =FileManager.get().open(file);*)

It writes the required result to the console(model.write method) but when I
try to write it in a file, it just remove all the data from the destination
file and even the ontology URI.

For writing to a file, I used these both methods but both does not work.

(1)   FileWriter out = new FileWriter( fileName );

try {
model.write( out, "RDF/XML-ABBREV" );}

2)   FileOutputStream out=new FileOutputStream(filename);
RDFWriter d = model.getWriter("RDF/XML-ABBREV");
d.write(model,out,null);
}catch(Exception e) {}


On Fri, Jul 22, 2016 at 12:30 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> 1.) This is not a minimal running example! that means, nobody can test
> it without some (in your case too much) effort to get it running.
> 2.) w.r.t. 1), look at your main() method, it reads a file and then?
> 2.) Please tell us exactly WHAT does not work and WHAT you expect.
> 3.) The OntModel object has a method write, not sure what you did there
> with calling getWriter and the like
>
> > *When I run this program without writing it to the file, it runs
> smoothly.
> > But when I copy it to a file (both newly created and existing file),
> > sometime it adds the garbage claases to the file like Seq, Bag, Resource
> > and most of the time it does nothing except it empties the destination
> > file.*
> >
> > *I have copied the whole code except the code auto generated by netbeans*
> >
> >
> >
> >
> >
> > *public class NewJFrame extends javax.swing.JFrame {*
> >
> >
> >
> >
> >
> >
> > *public static void readOntology(String file,OntModel model)*
> >
> > *{*
> >
> >
> > *InputStream in =FileManager.get().open(file);*
> >
> >
> >
> > *if (in==null) {*
> >
> > *throw new IllegalArgumentException( "File: " + file + " not  found");*
> >
> > *}*
> >
> > * model.read(in,null);*
> >
> > * //in.close();}}*
> >
> >
> >
> >  private  void read1(String str, OntModel model)
> >
> > {
> >
> >
> >
> >
> >
> >
> >
> >String ns="
> > http://www.semanticweb.org/ontologies/untitled-ontology-54/;;
> >
> >
> >  OntClass user = model.createClass(ns + "User");
> >
> >
> >
> >
> >
> >  OntClass user1 = model.getOntClass(ns + "User");
> >
> > Individual janeSmith = user1.createIndividual(ns + str)
> >
> >
> >
> > try {
> >
> >String file="F://newontology.owl";
> >
> >
> >
> >
> >
> >FileOutputStream f1=new FileOutputStream(file);
> >
> > RDFWriter d = model.getWriter("RDF/XML-ABBREV");
> >
> > d.write(model,f1,null);
> >
> > }catch(Exception e) {}
> >
> >
> >  *private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
> >   *
> >
> >
> >
> > *OntModel model=ModelFactory.createOntologyModel();*
> >
> >
> > *String str=jTextField2.getText()*
> >
> >
> >
> > *  read1(str,  model); }}*
> >
> >
> >
> > * public static void main(String args[]) {*
> >
> >
> >
> >
> >
> >
> >
> > *OntModel model = ModelFactory.createOntologyModel();*
> >
> > *String file="F://updated.owl";*
> >
> > * readOntology(file , model );*
> >
> > *}*
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Can not write to the file

2016-07-21 Thread kumar rohit
*When I run this program without writing it to the file, it runs smoothly.
But when I copy it to a file (both newly created and existing file),
sometime it adds the garbage claases to the file like Seq, Bag, Resource
and most of the time it does nothing except it empties the destination
file.*

*I have copied the whole code except the code auto generated by netbeans*





*public class NewJFrame extends javax.swing.JFrame {*






*public static void readOntology(String file,OntModel model)*

*{*


*InputStream in =FileManager.get().open(file);*



*if (in==null) {*

*throw new IllegalArgumentException( "File: " + file + " not  found");*

*}*

* model.read(in,null);*

* //in.close();}}*



 private  void read1(String str, OntModel model)

{







   String ns="
http://www.semanticweb.org/ontologies/untitled-ontology-54/;;


 OntClass user = model.createClass(ns + "User");





 OntClass user1 = model.getOntClass(ns + "User");

Individual janeSmith = user1.createIndividual(ns + str)



try {

   String file="F://newontology.owl";





   FileOutputStream f1=new FileOutputStream(file);

RDFWriter d = model.getWriter("RDF/XML-ABBREV");

d.write(model,f1,null);

}catch(Exception e) {}


 *private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  *



*OntModel model=ModelFactory.createOntologyModel();*


*String str=jTextField2.getText()*



*  read1(str,  model); }}*



* public static void main(String args[]) {*







*OntModel model = ModelFactory.createOntologyModel();*

*String file="F://updated.owl";*

* readOntology(file , model );*

*}*


Re: Jena Code has emptied my ontology

2016-07-16 Thread kumar rohit
Here is the full code,

public static void readOntology(String file,OntModel model)

{


InputStream in =FileManager.get().open(file);



if (in==null) {

throw new IllegalArgumentException( "File: " + file + "  not found");

}

model.read(in,"RDF/XML-ABBREV");

//in.close();



   model.write(System.out);



}

___

private static void read1(String str,OntModel model)

{



  String ns="http://www.semanticweb.org/untitled-ontology-0012/;;

 OntClass user = model.createClass(ns + "User");



 OntClass user1 = model.getOntClass(ns + "User");

Individual janeSmith = user1.createIndividual(ns + str);



JOptionPane.showMessageDialog(null, janeSmith.toString());



try {

   String file="F://hello.owl";





FileWriter out=new FileWriter(file);

model.write( out, "RDF/XML-ABBREV" );

 } catch (IOException ex) {

Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
null, ex);

}

}

_


 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {



OntModel model=ModelFactory.createOntologyModel();

String str=jTextField2.getText();




  read1(str, model);

}

_


and finally main()


public static void main(String args[]) {







OntModel model = ModelFactory.createOntologyModel();

String file="F://hello.owl";

readOntology(file , model );

On Sat, Jul 16, 2016 at 6:27 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> That code doesn't write to disk, so it's impossible.
>
> The only part that COULD write to file, but doesn't is
>
> FileWriter out=new FileWriter(file);
>
>
>
> I'm sure that it's not the whole code, so it's impossible to help.
> Moreover, it's more a Java related question - nothing for the Jena
> mailing list.
>
> > Hi
> >
> > I am very surprised that this code, when executed, has vanished my
> ontology
> > and my ontology is now empty. I copied another ontology and after
> executing
> > few times, again the new ontology is empty. I just want to create the
> > individual of class and save it locally in the file. There is another
> > method also in my code but thats just read the file so the main trick is
> > here. It writed the whole ontology first as model.write() but when GUI
> > loads and I enter text, again it display output as in
> > JOptionPane.showMessageDialog() but after the whole exection, the Protege
> > ontology becomes empty.
> >
> >
> > *Note: It also create the intended individual but except the User1 class
> > created in Jena code and its individual, nothing remains in ontology.*
> >
> >
> >
> >  public static void readOntology(String file,OntModel model)
> >
> > {
> >
> >
> > InputStream in =FileManager.get().open(file);
> >
> >
> >
> > if (in==null) {
> >
> > throw new IllegalArgumentException( "File: " + file + "  not found");
> >
> > }
> >
> > model.read(in,"RDF/XML-ABBREV");
> >
> > //in.close();
> >
> >
> >
> >model.write(System.out);
> >
> >
> >
> > }
> >
> >
> >
> >
> >
> > private static void read1(String str,OntModel model)
> >
> > {
> >
> >
> >
> >   String ns="http://www.semanticweb.org/untitled-ontology-0012/;;
> >
> >  OntClass user = model.createClass(ns + "User");
> >
> >
> >
> >  OntClass user1 = model.getOntClass(ns + "User");
> >
> > Individual janeSmith = user1.createIndividual(ns + str);
> >
> >
> >
> > JOptionPane.showMessageDialog(null, janeSmith.toString());
> >
> >
> >
> > try {
> >
> >String file="F://hello.owl";
> >
> >
> >
> >
> >
> > FileWriter out=new FileWriter(file);
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Jena Code has emptied my ontology

2016-07-15 Thread kumar rohit
Hi

I am very surprised that this code, when executed, has vanished my ontology
and my ontology is now empty. I copied another ontology and after executing
few times, again the new ontology is empty. I just want to create the
individual of class and save it locally in the file. There is another
method also in my code but thats just read the file so the main trick is
here. It writed the whole ontology first as model.write() but when GUI
loads and I enter text, again it display output as in
JOptionPane.showMessageDialog() but after the whole exection, the Protege
ontology becomes empty.


*Note: It also create the intended individual but except the User1 class
created in Jena code and its individual, nothing remains in ontology.*



 public static void readOntology(String file,OntModel model)

{


InputStream in =FileManager.get().open(file);



if (in==null) {

throw new IllegalArgumentException( "File: " + file + "  not found");

}

model.read(in,"RDF/XML-ABBREV");

//in.close();



   model.write(System.out);



}





private static void read1(String str,OntModel model)

{



  String ns="http://www.semanticweb.org/untitled-ontology-0012/;;

 OntClass user = model.createClass(ns + "User");



 OntClass user1 = model.getOntClass(ns + "User");

Individual janeSmith = user1.createIndividual(ns + str);



JOptionPane.showMessageDialog(null, janeSmith.toString());



try {

   String file="F://hello.owl";





FileWriter out=new FileWriter(file);


Re: Exception in the code

2016-07-15 Thread kumar rohit
at you call
> >>>>>>
> >>>>>> read(str, null) thus the second argument is null.
> >>>>>>
> >>>>>> Moreover, you did not show the read() method but only
> readOntology(),
> >>>>>> thus, nobody knows what's going inside the read() method. But
> >> obviously,
> >>>>>> some object is null and you call a method on that. I suggest to use
> a
> >>>>>> Java debugger.
> >>>>>>
> >>>>>>> *As I also mentioned in the code: model.write(), it writes the rdf
> to
> >>>>>>> console and load the GUI also.*
> >>>>>>> *But when I enter text and press button ,it gives exception error:*
> >>>>>>>
> >>>>>>> Exception in thread "AWT-EventQueue-0"
> java.lang.NullPointerException
> >>>>>>> at javaapplication4.NewJFrame.read(NewJFrame.java:53)
> >>>>>>> at
> >>>> javaapplication4.NewJFrame.jButton3ActionPerformed(NewJFrame.java:287)
> >>>>>>> at javaapplication4.NewJFrame.access$100(NewJFrame.java:27)
> >>>>>>> at javaapplication4.NewJFrame$2.actionPerformed(NewJFrame.java:135)
> >>>>>>>
> >>>>>>> On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne <a...@apache.org>
> >>>> wrote:
> >>>>>>>> This looks rather similar to ;
> >>>>>>>>
> >>>>>>>>
> >>>>
> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
> >>>>>>>> I suggest local collaboration.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On 13/07/16 16:37, kumar rohit wrote:
> >>>>>>>>
> >>>>>>>>> Hi
> >>>>>>>>> I have the following code in which I want to create an
> >>>>>> instance/individual
> >>>>>>>>> of the class Student. The student name is entered in a text box
> >> (in a
> >>>>>>>>> button even handler). But it gives exception.
> >>>>>>>>>
> >>>>>>>>> _
> >>>>>>>>>
> >>>>>>>>> public class NewJFrame extends javax.swing.JFrame {
> >>>>>>>>>
> >>>>>>>>>  public static void readOntology( String file, OntModel
> model )
> >>>>>>>>>  {
> >>>>>>>>>
> >>>>>>>>>  InputStream in = null;
> >>>>>>>>> try
> >>>>>>>>> {
> >>>>>>>>> in = new FileInputStream( file );
> >>>>>>>>> model.read(in, "RDF/XML");
> >>>>>>>>> in.close();
> >>>>>>>>> } catch (IOException e)
> >>>>>>>>> {
> >>>>>>>>> e.printStackTrace();
> >>>>>>>>> }
> >>>>>>>>>
> >>>>>>>>> My main() is the following.
> >>>>>>>>>
> >>>>>>>>> 
> >>>>>>>>>
> >>>>>>>>> public static void main(String args[]) {
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>  OntModel model = ModelFactory.createOntologyModel();
> >>>>>>>>>  String file="D://std.owl";
> >>>>>>>>> readOntology(file , model );
> >>>>>>>>> ___
> >>>>>>>>>
> >>>>>>>>> Button handler to get student name from text box is:
> >>>>>>>>>
> >>>>>>>>>   private void jButton2ActionPerformed(java.awt.event.ActionEvent
> >>>> evt)
> >>>>>> {
> >>>>>>>>>
> >>>>>>>>> String str=jTextField1.getText();
> >>>>>>>>>
> >>>>>>>>> read(str, null);
> >>>>>>>>> }
> >>>>>>>>> _
> >>>>>>>>>
> >>>>>>>>> WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source:
> >> {W136}
> >>>>>>>>> Relative URIs are not permitted in RDF: specifically 
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Exception in thread "AWT-EventQueue-0"
> >> java.lang.NullPointerException
> >>>>>>>>> at javaapplication4.NewJFrame.read(NewJFrame.java:50)
> >>>>>>>>> at
> >>>>>>
> javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
> >>>>>>>>> at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
> >>>>>>>>> at
> javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
> >>>>>>>>> at
> >>>>>>>>>
> >> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
> >>>>>>>>> at
> >>>>>>>>>
> >>>>>>>>>
> >>
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
> >>>>>>>>> at
> >>>>>>>>>
> >>>>>>>>>
> >>
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
> >>>>>>>>> at
> >>>>>>
> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
> >>>>>> --
> >>>>>> Lorenz Bühmann
> >>>>>> AKSW group, University of Leipzig
> >>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>
> >>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Exception in the code

2016-07-14 Thread kumar rohit
I am sorry but I thought if Ontclass can be passed as null, so shall be
OntModel. My sole purpose is to pass the string entered by user to the
 read() which can be used  create individuals.

On Thu, Jul 14, 2016 at 5:03 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> In which the second argument is the class and not the model as in your
> code. It looks like you did mostly copy and paste without understanding
> the code.
>
> In your case the model is ALWAYS null, do you understand that?
> > I have read it here:
> > http://tutorial-academy.com/category/java/
> >
> > He used null argument in the main() method:
> >
> > public static void main(String[] args)
> > {
> > // create OntModel
> > OntModel model = ModelFactory.createOntologyModel();
> > // read camera ontology
> > readOntology( "./ontology/camera.owl", model );
> > // start traverse
> > traverseStart( model, null );
> > }
> >
> > On Thu, Jul 14, 2016 at 4:09 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> I don't get it. Where did you saw this in the Jena tutorial?
> >>
> >> And do you understand that when you call in your main()
> >>
> >> read(str, null);
> >>
> >> that the second argument is always null, thus, the code will never go
> >> into the if-clause?
> >>
> >>> The read() method is given below: I used null reference after reading
> >> this
> >>> tutorial of Jena which used it in main().
> >>> *Since I have to create individual of name entered in text field and
> then
> >>> button clicked, either I need OntClass in button handler or the string
> of
> >>> text field in the read() method.*
> >>>
> >>> private static void read(String str, OntModel model)
> >>> {
> >>>//OntModel model = ModelFactory.createOntologyModel();
> >>>
> >>> String ns="http://www.semanticweb.org/untitled-ontology-004/;;
> >>>
> >>> if (model!= null ) {
> >>>
> >>>  OntClass user1 = model.getOntClass(ns + "User");
> >>> Individual janeSmith = user1.createIndividual(ns + str);
> >>>
> >>>
> >>>try {
> >>>String file="F://updated.owl";
> >>>
> >>>
> >>> FileWriter out=new FileWriter(file);
> >>>
> >>>  model.write( out, "RDF/XML-ABBREV" );
> >>> } catch (IOException ex) {
> >>>
>  Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
> >>> null, ex);
> >>> }
> >>> }
> >>>
> >>> On Thu, Jul 14, 2016 at 1:38 AM, Lorenz B. <
> >>> buehm...@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> Andy already told you correctly that you call
> >>>>
> >>>> read(str, null) thus the second argument is null.
> >>>>
> >>>> Moreover, you did not show the read() method but only readOntology(),
> >>>> thus, nobody knows what's going inside the read() method. But
> obviously,
> >>>> some object is null and you call a method on that. I suggest to use a
> >>>> Java debugger.
> >>>>
> >>>>> *As I also mentioned in the code: model.write(), it writes the rdf to
> >>>>> console and load the GUI also.*
> >>>>> *But when I enter text and press button ,it gives exception error:*
> >>>>>
> >>>>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> >>>>> at javaapplication4.NewJFrame.read(NewJFrame.java:53)
> >>>>> at
> >> javaapplication4.NewJFrame.jButton3ActionPerformed(NewJFrame.java:287)
> >>>>> at javaapplication4.NewJFrame.access$100(NewJFrame.java:27)
> >>>>> at javaapplication4.NewJFrame$2.actionPerformed(NewJFrame.java:135)
> >>>>>
> >>>>> On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne <a...@apache.org>
> >> wrote:
> >>>>>> This looks rather similar to ;
> >>>>>>
> >>>>>>
> >> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
> >>>>>> I suggest local collaboration.
> >>>>>>
> >>>>>>
> >>>>>> On 13/07/16 16:37, kumar rohit w

Re: Exception in the code

2016-07-14 Thread kumar rohit
I have read it here:
http://tutorial-academy.com/category/java/

He used null argument in the main() method:

public static void main(String[] args)
{
// create OntModel
OntModel model = ModelFactory.createOntologyModel();
// read camera ontology
readOntology( "./ontology/camera.owl", model );
// start traverse
traverseStart( model, null );
}

On Thu, Jul 14, 2016 at 4:09 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> I don't get it. Where did you saw this in the Jena tutorial?
>
> And do you understand that when you call in your main()
>
> read(str, null);
>
> that the second argument is always null, thus, the code will never go
> into the if-clause?
>
> > The read() method is given below: I used null reference after reading
> this
> > tutorial of Jena which used it in main().
> > *Since I have to create individual of name entered in text field and then
> > button clicked, either I need OntClass in button handler or the string of
> > text field in the read() method.*
> >
> > private static void read(String str, OntModel model)
> > {
> >//OntModel model = ModelFactory.createOntologyModel();
> >
> > String ns="http://www.semanticweb.org/untitled-ontology-004/;;
> >
> > if (model!= null ) {
> >
> >  OntClass user1 = model.getOntClass(ns + "User");
> > Individual janeSmith = user1.createIndividual(ns + str);
> >
> >
> >try {
> >String file="F://updated.owl";
> >
> >
> > FileWriter out=new FileWriter(file);
> >
> >  model.write( out, "RDF/XML-ABBREV" );
> > } catch (IOException ex) {
> > Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
> > null, ex);
> > }
> > }
> >
> > On Thu, Jul 14, 2016 at 1:38 AM, Lorenz B. <
> > buehm...@informatik.uni-leipzig.de> wrote:
> >
> >> Andy already told you correctly that you call
> >>
> >> read(str, null) thus the second argument is null.
> >>
> >> Moreover, you did not show the read() method but only readOntology(),
> >> thus, nobody knows what's going inside the read() method. But obviously,
> >> some object is null and you call a method on that. I suggest to use a
> >> Java debugger.
> >>
> >>> *As I also mentioned in the code: model.write(), it writes the rdf to
> >>> console and load the GUI also.*
> >>> *But when I enter text and press button ,it gives exception error:*
> >>>
> >>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> >>> at javaapplication4.NewJFrame.read(NewJFrame.java:53)
> >>> at
> javaapplication4.NewJFrame.jButton3ActionPerformed(NewJFrame.java:287)
> >>> at javaapplication4.NewJFrame.access$100(NewJFrame.java:27)
> >>> at javaapplication4.NewJFrame$2.actionPerformed(NewJFrame.java:135)
> >>>
> >>> On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne <a...@apache.org>
> wrote:
> >>>
> >>>> This looks rather similar to ;
> >>>>
> >>>>
> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
> >>>>
> >>>> I suggest local collaboration.
> >>>>
> >>>>
> >>>> On 13/07/16 16:37, kumar rohit wrote:
> >>>>
> >>>>> Hi
> >>>>> I have the following code in which I want to create an
> >> instance/individual
> >>>>> of the class Student. The student name is entered in a text box (in a
> >>>>> button even handler). But it gives exception.
> >>>>>
> >>>>> _
> >>>>>
> >>>>> public class NewJFrame extends javax.swing.JFrame {
> >>>>>
> >>>>>  public static void readOntology( String file, OntModel model )
> >>>>>  {
> >>>>>
> >>>>>  InputStream in = null;
> >>>>> try
> >>>>> {
> >>>>> in = new FileInputStream( file );
> >>>>> model.read(in, "RDF/XML");
> >>>>> in.close();
> >>>>> } catch (IOException e)
> >>>>> {
> >>>>> e.printStackTrace();
> >>>>> }
> >>>>>
> >>>>> My main() is the following.
> >>>>>
> >>>>> 

Re: Exception in the code

2016-07-14 Thread kumar rohit
The read() method is given below: I used null reference after reading this
tutorial of Jena which used it in main().
*Since I have to create individual of name entered in text field and then
button clicked, either I need OntClass in button handler or the string of
text field in the read() method.*

private static void read(String str, OntModel model)
{
   //OntModel model = ModelFactory.createOntologyModel();

String ns="http://www.semanticweb.org/untitled-ontology-004/;;

if (model!= null ) {

 OntClass user1 = model.getOntClass(ns + "User");
Individual janeSmith = user1.createIndividual(ns + str);


   try {
   String file="F://updated.owl";


FileWriter out=new FileWriter(file);

 model.write( out, "RDF/XML-ABBREV" );
} catch (IOException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
null, ex);
}
}

On Thu, Jul 14, 2016 at 1:38 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Andy already told you correctly that you call
>
> read(str, null) thus the second argument is null.
>
> Moreover, you did not show the read() method but only readOntology(),
> thus, nobody knows what's going inside the read() method. But obviously,
> some object is null and you call a method on that. I suggest to use a
> Java debugger.
>
> > *As I also mentioned in the code: model.write(), it writes the rdf to
> > console and load the GUI also.*
> > *But when I enter text and press button ,it gives exception error:*
> >
> > Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> > at javaapplication4.NewJFrame.read(NewJFrame.java:53)
> > at javaapplication4.NewJFrame.jButton3ActionPerformed(NewJFrame.java:287)
> > at javaapplication4.NewJFrame.access$100(NewJFrame.java:27)
> > at javaapplication4.NewJFrame$2.actionPerformed(NewJFrame.java:135)
> >
> > On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne <a...@apache.org> wrote:
> >
> >> This looks rather similar to ;
> >>
> >> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
> >>
> >> I suggest local collaboration.
> >>
> >>
> >> On 13/07/16 16:37, kumar rohit wrote:
> >>
> >>> Hi
> >>> I have the following code in which I want to create an
> instance/individual
> >>> of the class Student. The student name is entered in a text box (in a
> >>> button even handler). But it gives exception.
> >>>
> >>> _
> >>>
> >>> public class NewJFrame extends javax.swing.JFrame {
> >>>
> >>>  public static void readOntology( String file, OntModel model )
> >>>  {
> >>>
> >>>  InputStream in = null;
> >>> try
> >>> {
> >>> in = new FileInputStream( file );
> >>> model.read(in, "RDF/XML");
> >>> in.close();
> >>> } catch (IOException e)
> >>> {
> >>> e.printStackTrace();
> >>> }
> >>>
> >>> My main() is the following.
> >>>
> >>> 
> >>>
> >>> public static void main(String args[]) {
> >>>
> >>>
> >>>
> >>>  OntModel model = ModelFactory.createOntologyModel();
> >>>  String file="D://std.owl";
> >>> readOntology(file , model );
> >>> ___
> >>>
> >>> Button handler to get student name from text box is:
> >>>
> >>>   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
> {
> >>>
> >>>
> >>>
> >>>
> >>> String str=jTextField1.getText();
> >>>
> >>> read(str, null);
> >>> }
> >>> _
> >>>
> >>> WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
> >>> Relative URIs are not permitted in RDF: specifically 
> >>>
> >>>
> >>>
> >>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> >>> at javaapplication4.NewJFrame.read(NewJFrame.java:50)
> >>> at
> javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
> >>> at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
> >>> at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
> >>> at
> >>>
> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
> >>> at
> >>>
> >>>
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
> >>> at
> >>>
> >>>
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
> >>> at
> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
> >>>
> >>>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Exception in the code

2016-07-13 Thread kumar rohit
The error message no changed to : I dont think its UI problem


ERROR [main] (RDFDefaultErrorHandler.java:44) - Premature end of file.
Exception in thread "main" com.hp.hpl.jena.shared.JenaException:
org.xml.sax.SAXParseException; Premature end of file.
at
com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler.fatalError(RDFDefaultErrorHandler.java:45)
at
com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fatalError(ARPSaxErrorHandler.java:35)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning(XMLHandler.java:225)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.fatalError(XMLHandler.java:255)

On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne <a...@apache.org> wrote:

> This looks rather similar to ;
>
> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
>
> I suggest local collaboration.
>
>
> On 13/07/16 16:37, kumar rohit wrote:
>
>> Hi
>> I have the following code in which I want to create an instance/individual
>> of the class Student. The student name is entered in a text box (in a
>> button even handler). But it gives exception.
>>
>> _
>>
>> public class NewJFrame extends javax.swing.JFrame {
>>
>>  public static void readOntology( String file, OntModel model )
>>  {
>>
>>  InputStream in = null;
>> try
>> {
>> in = new FileInputStream( file );
>> model.read(in, "RDF/XML");
>> in.close();
>> } catch (IOException e)
>> {
>> e.printStackTrace();
>> }
>>
>> My main() is the following.
>>
>> 
>>
>> public static void main(String args[]) {
>>
>>
>>
>>  OntModel model = ModelFactory.createOntologyModel();
>>  String file="D://std.owl";
>> readOntology(file , model );
>> ___
>>
>> Button handler to get student name from text box is:
>>
>>   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
>>
>>
>>
>>
>> String str=jTextField1.getText();
>>
>> read(str, null);
>> }
>> _
>>
>> WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
>> Relative URIs are not permitted in RDF: specifically 
>>
>>
>>
>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
>> at javaapplication4.NewJFrame.read(NewJFrame.java:50)
>> at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
>> at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
>> at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
>> at
>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
>> at
>>
>> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
>> at
>>
>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
>> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
>>
>>
>


Fwd: Exception in the code

2016-07-13 Thread kumar rohit
Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

public static void readOntology( String file, OntModel model )
{

InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



OntModel model = ModelFactory.createOntologyModel();
String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}

And read() is following
___


 private static void read(String str, OntModel model)
{
String ns="http://www.semanticweb.org/untitled-ontology-112/;;
 OntClass univer = model.createClass(ns + str);
try {

FileWriter out=new FileWriter("D://std.owl");

 model.write( out, "RDF/XML-ABBREV" );
} catch (IOException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
null, ex);
}
__



WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)


Exception in the code

2016-07-13 Thread kumar rohit
Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

public static void readOntology( String file, OntModel model )
{

InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



OntModel model = ModelFactory.createOntologyModel();
String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}
_

WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)


Re: Resource cant add to rdf file

2016-07-09 Thread kumar rohit
I have updated the code and now it works. thanks for your support sir

OntClass student = model.createClass(ns + "Student");

On Sat, Jul 9, 2016 at 4:48 AM, kumar rohit <kumar.en...@gmail.com> wrote:

> I am sorry sir, I have read this file so many times but I do not know why
> things are going well for me still.
> Let me read it again.
>
> On Sat, Jul 9, 2016 at 4:35 AM, Lorenz B. <
> buehm...@informatik.uni-leipzig.de> wrote:
>
>> The problem is that you still did not learn enough about RDF, OWL and
>> SPARQL...
>>
>> If you create a resource with JENA, what do you think is it? An
>> individual, a class, a property? JENA, and I'm talking here about the
>> methods you used, creates RDF, not OWL. Protege on the other hand reads
>> and works on OWL ontologies(ok, it also supports OBO, but that's another
>> topic). Please read the tutorial [1] about JENA and OWL, then I think
>> you will make it
>>
>> [1] https://jena.apache.org/documentation/ontology/
>>
>> Kind regards,
>> Lorenz
>>
>> > After executing this code, I can not find the resource (Ranjani) in my
>> > Protege owl file. Where is the mistake in code?
>> >
>> >
>> >
>> >
>> > public class rdffile {
>> > public static void main(String[] args) throws IOException {
>> >
>> > String ns = "
>> > http://www.semanticweb.org/ontologies/2016/7/my-ontology-54#Ranjani;;
>> >
>> >
>> >
>> >Model model=ModelFactory.createDefaultModel();
>> > InputStream in = FileManager.get().open("C:/User/Desktop/first.owl");
>> > if (in==null) {
>> > throw new IllegalArgumentException(
>> > "File: " +  " not found ");
>> > }
>> > model.read(in, "");
>> >
>> >
>> > Resource ranjani = model.createResource(ns+"Ranjani");
>> >
>> > String ss= "C:/Users/Desktop/first.owl";
>> >FileWriter out = new FileWriter( ss );
>> >
>> >  model.write(out, "RDF/XML-ABBREV");
>> >
>> --
>> Lorenz Bühmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
>


Re: Resource cant add to rdf file

2016-07-09 Thread kumar rohit
I am sorry sir, I have read this file so many times but I do not know why
things are going well for me still.
Let me read it again.

On Sat, Jul 9, 2016 at 4:35 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> The problem is that you still did not learn enough about RDF, OWL and
> SPARQL...
>
> If you create a resource with JENA, what do you think is it? An
> individual, a class, a property? JENA, and I'm talking here about the
> methods you used, creates RDF, not OWL. Protege on the other hand reads
> and works on OWL ontologies(ok, it also supports OBO, but that's another
> topic). Please read the tutorial [1] about JENA and OWL, then I think
> you will make it
>
> [1] https://jena.apache.org/documentation/ontology/
>
> Kind regards,
> Lorenz
>
> > After executing this code, I can not find the resource (Ranjani) in my
> > Protege owl file. Where is the mistake in code?
> >
> >
> >
> >
> > public class rdffile {
> > public static void main(String[] args) throws IOException {
> >
> > String ns = "
> > http://www.semanticweb.org/ontologies/2016/7/my-ontology-54#Ranjani;;
> >
> >
> >
> >Model model=ModelFactory.createDefaultModel();
> > InputStream in = FileManager.get().open("C:/User/Desktop/first.owl");
> > if (in==null) {
> > throw new IllegalArgumentException(
> > "File: " +  " not found ");
> > }
> > model.read(in, "");
> >
> >
> > Resource ranjani = model.createResource(ns+"Ranjani");
> >
> > String ss= "C:/Users/Desktop/first.owl";
> >FileWriter out = new FileWriter( ss );
> >
> >  model.write(out, "RDF/XML-ABBREV");
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Resource cant add to rdf file

2016-07-09 Thread kumar rohit
After executing this code, I can not find the resource (Ranjani) in my
Protege owl file. Where is the mistake in code?




public class rdffile {
public static void main(String[] args) throws IOException {

String ns = "
http://www.semanticweb.org/ontologies/2016/7/my-ontology-54#Ranjani;;



   Model model=ModelFactory.createDefaultModel();
InputStream in = FileManager.get().open("C:/User/Desktop/first.owl");
if (in==null) {
throw new IllegalArgumentException(
"File: " +  " not found ");
}
model.read(in, "");


Resource ranjani = model.createResource(ns+"Ranjani");

String ss= "C:/Users/Desktop/first.owl";
   FileWriter out = new FileWriter( ss );

 model.write(out, "RDF/XML-ABBREV");


Re: Rdf model vs Ontmodel

2016-07-09 Thread kumar rohit
So it means I can achieve inference and Jena rules with Model?

On Fri, Jul 8, 2016 at 1:34 PM, Niels Andersen <ni...@thinkiq.com> wrote:

> Kumar,
>
> An OntModel is RDF plus a schema. The model is aware of the schema and has
> specific methods to deal with it.
>
> Best regards,
> Niels
>
> -----Original Message-
> From: kumar rohit [mailto:kumar.en...@gmail.com]
> Sent: Friday, July 8, 2016 11:26
> To: users@jena.apache.org
> Subject: Rdf model vs Ontmodel
>
> What is the difference between RDF and OntModel? Is the later  somewhat
> better than the other I am working on a project which will need some
> inference too like sub class/superclass inferencing, so which model is
> preferable here?
>
> regards
>


Rdf model vs Ontmodel

2016-07-08 Thread kumar rohit
What is the difference between RDF and OntModel? Is the later  somewhat
better than the other
I am working on a project which will need some inference too like sub
class/superclass inferencing, so which model is preferable here?

regards


Re: Adding individual to a jena file

2016-07-01 Thread kumar rohit
Thank you for your reply.
Is there any need for SPARQL update query or things will be happily done
with Jena code?
thanks

On Fri, Jul 1, 2016 at 1:53 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> When you're modifying the model, all happens in-memory. You have to
> write the model back to file, as Andy suggest, there is a good Jena API
> tutorial.
>
> > I am sorry but I used model.read method but did not mention it in the
> code.
> > I mean the rdf file is readed successfully but still I could not find the
> > individual when I open the file in Protege.
> >
> >
> > On Thu, Jun 30, 2016 at 1:51 PM, Andy Seaborne <a...@apache.org> wrote:
> >
> >> On 30/06/16 21:43, kumar rohit wrote:
> >>
> >>> I have an rdf file on c:/users/desktop/std.rdf. I have the following
> jena
> >>> code
> >>>
> >>
> >> which does not read the file.
> >>
> >>
> >>> *String personURI = "c://users/desktop/rohit/std.rdf";*
> >>>
> >> There is no connection between using a URI and a file.  That is just a
> >> string used as a URI.  If you change it ... you don't get "file not
> found"
> >>
> >> * String fullName = "rohit kumar";*
> >>> *// create an empty Model*
> >>> *Model model = ModelFactory.createDefaultModel();*
> >>>
> >> Empty model.
> >>
> >> *// create the resource*
> >>> *Resource res1 = model.createResource(personURI)..addProperty(VCARD.FN,
> >>> fullName);*
> >>>
> >>> What happens after this code? Is this save "rohit kumar" in the file
> >>> std.rdf?
> >>>
> >> No.
> >>
> >> read the file into a model (RDFDataMgr or model.read), change it, write
> it
> >> out again.
> >>
> >> See the tutorials.
> >>
> >>
> >>
> >>
> >>> I can not find this resource after running this code and open the file
> in
> >>> Protege?
> >>>
> >>>
> >> Andy
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Adding individual to a jena file

2016-07-01 Thread kumar rohit
I am sorry but I used model.read method but did not mention it in the code.
I mean the rdf file is readed successfully but still I could not find the
individual when I open the file in Protege.


On Thu, Jun 30, 2016 at 1:51 PM, Andy Seaborne <a...@apache.org> wrote:

> On 30/06/16 21:43, kumar rohit wrote:
>
>> I have an rdf file on c:/users/desktop/std.rdf. I have the following jena
>> code
>>
>
>
> which does not read the file.
>
>
>> *String personURI = "c://users/desktop/rohit/std.rdf";*
>>
>
> There is no connection between using a URI and a file.  That is just a
> string used as a URI.  If you change it ... you don't get "file not found"
>
> * String fullName = "rohit kumar";*
>> *// create an empty Model*
>> *Model model = ModelFactory.createDefaultModel();*
>>
>
> Empty model.
>
> *// create the resource*
>> *Resource res1 = model.createResource(personURI)..addProperty(VCARD.FN,
>> fullName);*
>>
>> What happens after this code? Is this save "rohit kumar" in the file
>> std.rdf?
>>
>
> No.
>
> read the file into a model (RDFDataMgr or model.read), change it, write it
> out again.
>
> See the tutorials.
>
>
>
>
>> I can not find this resource after running this code and open the file in
>> Protege?
>>
>>
> Andy
>


Adding individual to a jena file

2016-06-30 Thread kumar rohit
I have an rdf file on c:/users/desktop/std.rdf. I have the following jena
code

*String personURI = "c://users/desktop/rohit/std.rdf";*
* String fullName = "rohit kumar";*
*// create an empty Model*
*Model model = ModelFactory.createDefaultModel();*
*// create the resource*
*Resource res1 = model.createResource(personURI)..addProperty(VCARD.FN,
fullName);*

What happens after this code? Is this save "rohit kumar" in the file
std.rdf?

I can not find this resource after running this code and open the file in
Protege?


Modularize Jena code

2016-06-17 Thread kumar rohit
While building semantic web application, how can I organise my code? For
instance, I have OWL file in Protege and multiple (say 50 queries) .

In one class I imported/read the file but confuse then what to do next?
Will there be a separate method i-e ExecSparql1() for each sparql query or
there is something which is simple?

Thanks


error in jena code

2016-05-21 Thread kumar rohit
Hello

I created a model in main method like:

 OntModel model=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
InputStream in = FileManager.get().open("C:/Users/Desktop/vehicle.owl");
if (in==null) {
throw new IllegalArgumentException(
"File: " +  " not found ");
}
model.read(in, "");
sparqltest();


In sparqltest() method I used Sparql query and

 Query query = QueryFactory.create(queryString);
QueryExecution qe =  QueryExecutionFactory.create( query,model);

The model argument in "QueryExecutionFactory.create( query,model);" gives
me error.
I know it is a local variable in main() method but how can we remove this
error ?

regards


Re: Individual in Existing ontology

2016-05-14 Thread kumar rohit
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 <
buehm...@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_source=link_campaign=sig-email_content=webmail
>> >
>> Virus-free.
>> www.avast.com
>> <
>> https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail
>> >
>> <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>>
>


Individual in Existing ontology

2016-05-13 Thread kumar rohit
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


Virus-free.
www.avast.com

<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


How this query works

2016-05-02 Thread kumar rohit
I used this query in Jena after reading protege file.

*"SELECT * " + "WHERE {"   + "?y Mo:has_question Mo:uk_capital." +  "}" ;*

*and it gives me correct answer of London which I created from dbpedia
inside Protege. *

*So now I want population of London (from value of ?y), how can I achieve
this.*
*(Like ?y dbo:population ?x)*

*I am confuse how this will happen in same query because either we use*

*QueryExecution qe =  QueryExecutionFactory.create( query,model); for
executing protege file or*


*QueryExecution qe =
 QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql
", query) ; for executing dbpedia query.*

*Regards*


Topics search on dbpedia

2016-04-29 Thread kumar rohit
If I have to fine some information about Physics course like Scalar
products, vector products, what is momentum, torque etc, how can I get this
information from dbpedia.
Most of these information are available on wikipedia but I could not find
it on dbpedia.

Moreover. this query does not work on Virtuoso editor.

*select ?x where {dbr:Inertia dbp-ont:abstract ?x}*


*http://factforge.net/resource/dbpedia/Inertia
*


Re: http://factforge.net/resource/dbpedia

2016-04-28 Thread kumar rohit
I want to know how can I use this in my Jena query?

http://factforge.net/resource/dbpedia/Inertia

Can we use the "Inertia" as a resource i-e* dbr:Inertia rdfs:label ?label*

On Thu, Apr 28, 2016 at 1:58 PM, A. Soroka <aj...@virginia.edu> wrote:

> For the first question, you need to request support from whomever runs
> http://factforge.net. As to how you use it in Jena code, that is much too
> vague a question. Can you be a good deal more specific? What are you trying
> to do?
>
> ---
> A. Soroka
> The University of Virginia Library
>
> > On Apr 28, 2016, at 4:15 AM, kumar rohit <kumar.en...@gmail.com> wrote:
> >
> > Hello
> >
> > What is "http://factforge.net/resource/dbpedia; and how it is differ
> from
> > dbpedia.org/resource.
> >
> > How can we use it in our jena code?
>
>


http://factforge.net/resource/dbpedia

2016-04-28 Thread kumar rohit
Hello

What is "http://factforge.net/resource/dbpedia; and how it is differ from
dbpedia.org/resource.

How can we use it in our jena code?


Re: How to read from file & web in one query

2016-04-25 Thread kumar rohit
I have one locan ontology from Protege and another I want to query dbpedia
endpoint. The scenario is something like I have is Subject and property
from my protege ontology and object which I already imported in Protege is
from dbpedia.
Suppose I have

Prefix MO < www.semanticweb/myontology#>
Prefix dbpedia< http://dbpedia.org/resource/>

select ?obj where { MO:TajMahal MO:locatedIn ?obj}

So Subject/predicate from local ontology and object/instance from dbpedia

regards

On Sat, Apr 23, 2016 at 10:02 PM, Andy Seaborne <a...@apache.org> wrote:

> The SERVICE keyword in SPARQL allows the query to call out to another
> SPARQL endpoint.
>
> Andy
>
>
> On 20/04/16 15:23, kumar rohit wrote:
>
>> Hello
>>
>> How can we read a file from Protege and web i-e dbpedia in one SParql
>> query
>> using Jena code.
>>
>> Suppose I have subject and predicate from my Protege ontology and Object
>> from Dbpedia like:
>>
>> Mod:EiffelTower Mod:resides_In ?var  (?var should be France from Dbpedia
>> resource)
>>
>> How can we write the query in Jena? Is it necessary that first we will
>> import/read the entire Protege file in Jena or some other way exists?
>>
>>
>


How to read from file & web in one query

2016-04-20 Thread kumar rohit
Hello

How can we read a file from Protege and web i-e dbpedia in one SParql query
using Jena code.

Suppose I have subject and predicate from my Protege ontology and Object
from Dbpedia like:

Mod:EiffelTower Mod:resides_In ?var  (?var should be France from Dbpedia
resource)

How can we write the query in Jena? Is it necessary that first we will
import/read the entire Protege file in Jena or some other way exists?


Re: Exception in Jena code

2016-02-29 Thread kumar rohit
I am sorry Lorenz sir, here is the code.

String service = "http://dbpedia.org/sparql;;
   String query = "PREFIX rdfs: 
SELECT ?label " +
   "WHERE {" +
" <
http://dbpedia.org/ontology/country> ?y ."+
"?y rdfs:label ?label ."+
"FILTER (LANG(?label) = 'en')"+
   "}";
   QueryExecution qe = QueryExecutionFactory.sparqlService(service, query);
   try {
   ResultSet results = qe.execSelect();

   for (; results.hasNext();) {

   QuerySolution sol = (QuerySolution) results.next();

   System.out.println(sol.get("?abstract"));

   }

   }catch(Exception e){

   e.printStackTrace();
   }
   finally {

  qe.close();
   }
}

On Mon, Feb 29, 2016 at 3:19 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> And how can somebody help you without seeing the code? And where NULL is
> returned.
>
>
> I think it was the problem of not including the right prefix. I included
>> it, the error goes away but it just ouput "null". I do not know why, but
>> it
>> gives me the result at SPARQL endpoint, but in Jena, it shows null as
>> output.
>>
>> On Mon, Feb 29, 2016 at 12:30 PM, Andy Seaborne  wrote:
>>
>> What have you tried?
>>>
>>> Before firing off questions, try to solve basic java issues using google,
>>> stackoverflow etc.
>>>
>>> Caused by: java.net.UnknownHostException: dbpedia.org
>>>
>>> so it's a networking issue in your environment.
>>> Firewall, misconfigured DNS etc.
>>>
>>> Study the output of
>>> nslookup dbpedia.org
>>>
>>>  Andy
>>>
>>>
>>> On 29/02/16 11:29, Lorenz B. wrote:
>>>
>>> It has to be http://dbpedia.org/sparql

 Hello I am getting this exception when I run jena against dbpedia.

> What is
> the problem?
> ++
> :WARN No appenders could be found for logger
> (org.apache.jena.riot.system.stream.JenaIOEnvironment).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
> for
> more info.
> HttpException: java.net.UnknownHostException: dbpedia.org: Unexpected
> error
> making the query: java.net.UnknownHostException: dbpedia.org
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.rewrap(HttpQuery.java:417)
> at
>
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:358)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:295)
> at
>
>
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:346)
>
> at
>
>
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:338)
>
> at jenaclass.main(jenaclass.java:24)
> Caused by: java.net.UnknownHostException: dbpedia.org
> at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
> at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
> at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
> at java.net.InetAddress.getAllByName0(Unknown Source)
> at java.net.InetAddress.getAllByName(Unknown Source)
> at java.net.InetAddress.getAllByName(Unknown Source)
> at
>
>
> org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
>
> at
>
>
> org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
>
> at
>
>
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
>
> at
>
>
> org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
>
> at
>
>
> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
>
> at
>
>
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
>
> at
>
>
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
>
> at
>
>
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
>
> at
>
>
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:118)
>
> at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1108)
>
>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Exception in Jena code

2016-02-29 Thread kumar rohit
Hello I am getting this exception when I run jena against dbpedia. What is
the problem?
++
:WARN No appenders could be found for logger
(org.apache.jena.riot.system.stream.JenaIOEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
HttpException: java.net.UnknownHostException: dbpedia.org: Unexpected error
making the query: java.net.UnknownHostException: dbpedia.org
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.rewrap(HttpQuery.java:417)
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:358)
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:295)
at
com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:346)
at
com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:338)
at jenaclass.main(jenaclass.java:24)
Caused by: java.net.UnknownHostException: dbpedia.org
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
at
org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at
org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
at
org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:118)
at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1108)


Re: Problem in Jena query

2016-02-26 Thread kumar rohit
Thank you for your response.
I could not understand, kindly if you can explain it briefly.

Best regards

On Fri, Feb 26, 2016 at 4:58 PM, Lorenz buehmann <
buehm...@informatik.uni-leipzig.de> wrote:

> among others, two options:
>
> 1) simply use the last part of the URI in your Java code
> 2) ask for the rdfs:label for each ?s in the query
>
> Lorenz
>
>
> On 26.02.2016 16:37, kumar rohit wrote:
>
>> I want to ask a question from dbpedia using Jena code. There is a GUI
>> button in eclipse "Solve question" when clicked JEna code is executed and
>> SPARQL query runs against dbpedia.
>> The question is what is capital city of Germany and have four options. My
>> query is like this:
>>
>> select distinct ?rightAnswer ?wrongAnswer where {
>>dbr:Germany dbo:capital ?rightAnswer .   ?s dbo:capital ?wrongAnswer .
>>filter ( ?s != dbr:Germany && ?wrongAnswer != ?rightAnswer )} limit 4
>>
>> It gives me answer like shown in table below: I want answer in format
>> like this so that user can select one name:
>>
>> .Berlin
>>
>> .Padeborn
>>
>> .Budapest
>>
>> .Stanley
>>
>> How can I achieve this?
>>
>> rightAnswerwrongAnswer
>> http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Apia
>> http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Paderborn
>> http://dbpedia.org/resource/Berlin
>> http://dbpedia.org/resource/Stanley,_Falkland_Islands
>> http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Budapest
>>
>>
>


Problem in Jena query

2016-02-26 Thread kumar rohit
I want to ask a question from dbpedia using Jena code. There is a GUI
button in eclipse "Solve question" when clicked JEna code is executed and
SPARQL query runs against dbpedia.
The question is what is capital city of Germany and have four options. My
query is like this:

select distinct ?rightAnswer ?wrongAnswer where {
  dbr:Germany dbo:capital ?rightAnswer .   ?s dbo:capital ?wrongAnswer .
  filter ( ?s != dbr:Germany && ?wrongAnswer != ?rightAnswer )} limit 4

It gives me answer like shown in table below: I want answer in format
like this so that user can select one name:

.Berlin

.Padeborn

.Budapest

.Stanley

How can I achieve this?

rightAnswerwrongAnswer
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Apia
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Paderborn
http://dbpedia.org/resource/Berlin
http://dbpedia.org/resource/Stanley,_Falkland_Islands
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Budapest


Dbo vs Dbp

2016-02-24 Thread kumar rohit
Hello

I do not know when to use dbo and when to use dbp when we query using
dbpedia. Kindly if some one can explain how to use these in which scenarios?

Regards


Re: Jena code in our Java program

2016-02-20 Thread kumar rohit
Thank you Lorenz sir for your reply.

If we have to execute multiple queries, then we have to do it for each
button or we can execute multiple queries under one button's code.
Also, can we simultaneously run and extract data from dbpedia and freebase?

Kind regards

>
>>>


Jena code in our Java program

2016-02-17 Thread kumar rohit
Hello
Suppose I hava a SPARAL query which extract india flag from dbpedia & I use
this query inside Jena code.
Now how can i use it in my normal Java application using eclipse. Suppose I
have a Java gui program having a button "Show flag" , then how can we use
it here.
Do we need to run the query inside the action handler code of the button or
any thing else.

Please guide me here and if there is any literature available which uses
things like this (I mean implement Jena code in Java application).
I would really appreciate any help.

Regards


Re: Using Jena for OBDA to access non-relational datastores

2016-01-08 Thread kumar rohit
I am new to Ontop but I think it is suitable here in this scenario and you
can then use owl API implemented as maven.

Best regards

On Fri, Jan 8, 2016 at 4:33 PM, Benedikt Tröster <
troes...@stud.uni-heidelberg.de> wrote:

> Hello everyone,
>
> I know Jena is not exactly made for OBDA, but I guess you could achive
> sth. that is very close to what I want to do:
> I have an ontology for a process inside the medical domain. The idea is
> to use the ontology and query for the instances of data (which are
> located inside doc, xls files and a sharepoint). The access to this data
> should happen via a GUI where (as an example) you would click on: create
> a report. The system I want to create should then find out which data is
> needed (as stated in the ontology) and where it is stored and finally
> process it to show it in the GUI or wherever.
>
> I see that Jena does support access to triple stores, but I don't
> actually want to use the Extract-Transform-Load (ETL) approach, but
> instead use mappings and a rewritingsystem to access the data. This is
> due to the fact that the data in the sources will be changing constantly
> and therefore ETL does not seem fitting for me.
>
> Do you have any recommendations for me? Would that be possible to
> implement with Jena? Does it support query rewriting to other sources
> other than SQL?
>
> Currently I'm thinking about implementing this with the Ontop framework.
>
> Thanks so much for your valuable input! Happy new year and all the best! :)
>
> Best,
> Benedikt
>


Error in OBDA

2016-01-02 Thread kumar rohit
Hello. I have connected H2 database from Protege 5, have done ontop mapping
via Mapping manager but when I want to write query in Ontop SPARQL and
start quest reasoner, it gives me error" Quest in virtual A box mode
supports OBDA model with one single data source. your OBDA model contains
two sources"
The error screen shot is attached.
Kindly if some one can tell me what is the problem.

regards


RDF Streaming

2015-12-01 Thread kumar rohit
Hello please if some one can provide me the link of the "RDF streaming"
community, if one exists. ?
regards


Re: Big data vs Apachi Jena

2015-11-14 Thread kumar rohit
Hello can we use CSPARQL with normal RDF and ontology i-e without RDF
streaming? If we have existing ontology , how can we use CSPARQL instead of
SPARQL to query the ontology  ?

On Wed, Nov 11, 2015 at 10:20 AM, kumar rohit <kumar.en...@gmail.com> wrote:

> Hello sir,
>
> I have read the links you provided about the RDF streaming and CSPARQL and
> got some idea too.
> But I do not know what to do next. What areas can we select from it for my
> master thesis. Can you, kindly, point out some problem domains for me so
> that I can at least proceed in a direction?
>
> Best regards
>
> On Mon, Nov 2, 2015 at 7:53 AM, Emanuele Della Valle <
> emanuele.dellava...@polimi.it> wrote:
>
>> Dear Kumar,
>>
>> Semantic Web techs are definitely a valuable approach to master the
>> variety dimension of big data.
>>
>> In my work on Stream Reasoning [1], I use Jena in memory and esper [2] to
>> master the velocity and variety dimensions at once with the C-SPARQL engine
>> [3].
>>
>> I would not use Jena TDB to master volume and variety dimensions at once,
>> but you may want to check out the Optique EU project [5] for Semantic Web
>> techs used to this end.
>>
>> Enjoy,
>>
>> Emanuele
>>
>> [1]  http://www.streamreasoning.org/
>> [2] http://www.espertech.com/products/esper.php
>> [3] https://github.com/streamreasoning/CSPARQL-engine
>> [4] https://github.com/streamreasoning/CSPARQL-ReadyToGoPack
>> [5] http://optique-project.eu
>>
>> Inviato da iPhone
>>
>> Il giorno 31 ott 2015, alle ore 12:31, kumar rohit <kumar.en...@gmail.com
>> <mailto:kumar.en...@gmail.com>> ha scritto:
>>
>> Thank you Bob but I have seen some recently research combining these both
>> technologies like "Big data modeling using semantic tech" and something
>> related. If not with Apache Jena, can we combine these two technologies
>> like big data modeling or big data and triple stores or so?
>> Regards
>>
>> On Fri, Oct 30, 2015 at 2:16 PM, Rob Walpole <robkwalp...@gmail.com
>> <mailto:robkwalp...@gmail.com>> wrote:
>>
>> Usually when people talk about big data in anything but a very general
>> sense they are talking about Apache Hadoop and the MapReduce model which
>> is
>> a way of parallel processing very large data sets. This is a completely
>> different model to the RDF graph model supported by Apache Jena. That's
>> not
>> to say you can't process large data sets in parallel using Jena - but that
>> would be big data in the very general sense.
>>
>> Rob
>>
>>
>> On Thu, Oct 29, 2015 at 9:17 PM, kumar rohit <kumar.en...@gmail.com
>> <mailto:kumar.en...@gmail.com>>
>> wrote:
>>
>> Hello how can big data can be related with Jena or semantic web in
>> general?
>>
>>
>>
>


Re: Big data vs Apachi Jena

2015-11-02 Thread kumar rohit
Thank you Emanuele Della Valle for your valuable information.

On Mon, Nov 2, 2015 at 7:53 AM, Emanuele Della Valle <
emanuele.dellava...@polimi.it> wrote:

> Dear Kumar,
>
> Semantic Web techs are definitely a valuable approach to master the
> variety dimension of big data.
>
> In my work on Stream Reasoning [1], I use Jena in memory and esper [2] to
> master the velocity and variety dimensions at once with the C-SPARQL engine
> [3].
>
> I would not use Jena TDB to master volume and variety dimensions at once,
> but you may want to check out the Optique EU project [5] for Semantic Web
> techs used to this end.
>
> Enjoy,
>
> Emanuele
>
> [1]  http://www.streamreasoning.org/
> [2] http://www.espertech.com/products/esper.php
> [3] https://github.com/streamreasoning/CSPARQL-engine
> [4] https://github.com/streamreasoning/CSPARQL-ReadyToGoPack
> [5] http://optique-project.eu
>
> Inviato da iPhone
>
> Il giorno 31 ott 2015, alle ore 12:31, kumar rohit <kumar.en...@gmail.com
> <mailto:kumar.en...@gmail.com>> ha scritto:
>
> Thank you Bob but I have seen some recently research combining these both
> technologies like "Big data modeling using semantic tech" and something
> related. If not with Apache Jena, can we combine these two technologies
> like big data modeling or big data and triple stores or so?
> Regards
>
> On Fri, Oct 30, 2015 at 2:16 PM, Rob Walpole <robkwalp...@gmail.com
> <mailto:robkwalp...@gmail.com>> wrote:
>
> Usually when people talk about big data in anything but a very general
> sense they are talking about Apache Hadoop and the MapReduce model which is
> a way of parallel processing very large data sets. This is a completely
> different model to the RDF graph model supported by Apache Jena. That's not
> to say you can't process large data sets in parallel using Jena - but that
> would be big data in the very general sense.
>
> Rob
>
>
> On Thu, Oct 29, 2015 at 9:17 PM, kumar rohit <kumar.en...@gmail.com
> <mailto:kumar.en...@gmail.com>>
> wrote:
>
> Hello how can big data can be related with Jena or semantic web in
> general?
>
>
>


Re: Big data vs Apachi Jena

2015-10-31 Thread kumar rohit
Thank you Bob but I have seen some recently research combining these both
technologies like "Big data modeling using semantic tech" and something
related. If not with Apache Jena, can we combine these two technologies
like big data modeling or big data and triple stores or so?
Regards

On Fri, Oct 30, 2015 at 2:16 PM, Rob Walpole <robkwalp...@gmail.com> wrote:

> Usually when people talk about big data in anything but a very general
> sense they are talking about Apache Hadoop and the MapReduce model which is
> a way of parallel processing very large data sets. This is a completely
> different model to the RDF graph model supported by Apache Jena. That's not
> to say you can't process large data sets in parallel using Jena - but that
> would be big data in the very general sense.
>
> Rob
>
>
> On Thu, Oct 29, 2015 at 9:17 PM, kumar rohit <kumar.en...@gmail.com>
> wrote:
>
> > Hello how can big data can be related with Jena or semantic web in
> general?
> >
>


Big data vs Apachi Jena

2015-10-29 Thread kumar rohit
Hello how can big data can be related with Jena or semantic web in general?


Some topic for thesis

2015-10-10 Thread kumar rohit
Hello can some one provide me areas/topics potential for my master thesis?
Any topic related to Jena or so? I would be thank full.


REST Web services role in Jena and Semantic web

2015-09-09 Thread kumar rohit
Hello what are the uses of Restful web services and AJAX in developing
semantic web applications. I mean if I have an owl file/ontology in Jena,
where is the role of the Restful web services and Ajax tool then?


Re: Web Development tools

2015-09-04 Thread kumar rohit
I could not understand it, what is it and its purpose? How it replace tools
like JSP and Java?

On Fri, Sep 4, 2015 at 4:19 PM, Adrian Walker <adriandwal...@gmail.com>
wrote:

> Kumar,
>
> You may be interested in the advanced semantics in the Executable English
> system --
>
>  www.reengineeringllc.com/internet_business_logic_in_a_nutshell.pdf
>
>  -- Adrian
>
> Executable Open English / Internet Business Logic
> Online at www.reengineeringllc.com
> Nothing to download, shared use is free, and there are no advertisements
>
>
> On Fri, Sep 4, 2015 at 12:44 AM, kumar rohit <kumar.en...@gmail.com>
> wrote:
>
> > BEA Workshop IDE, JSP, Jena TDB, Spring and Sparql... These tools are
> > sufficient to build a Semantic Web application?
> > Is there any need for another tool or technology ? Please guide me.
> >
>


Web Development tools

2015-09-04 Thread kumar rohit
BEA Workshop IDE, JSP, Jena TDB, Spring and Sparql... These tools are
sufficient to build a Semantic Web application?
Is there any need for another tool or technology ? Please guide me.


Re: Semantic Website

2015-08-28 Thread kumar rohit
Thank you Nicolas can you send me some literature about it just to start
with? Also the other tools you mentioned, if you have some tutorials for
beginners?
regards

On Fri, Aug 28, 2015 at 12:14 PM, Nicolas Paris nipari...@gmail.com wrote:

 Hello,

 I am building such website and after some testing I use :
 - backend : jersey rest service with jena behind, with pa4rdf to map java
 object as TDB triple
 - frontend : angularjs that talks with rest services
 - security with spring security

 If you just started jsp, you can moove on angularjs, it's works similar
 (with templates  balises ) but saves time  looks modern.


 2015-08-28 12:52 GMT+02:00 Jean-Marc Vanel jeanmarc.va...@gmail.com:

  You may try my semantic_forms;
  this is both a generic semantic web navigation and annotation
 application,
  and a framework to build business apps.
 
  It leverages on Jena TDB, Play! Framework and Scala.
 
  https://github.com/jmvanel/semantic_forms/tree/master/scala/forms_play
 
 
 
  2015-08-28 12:46 GMT+02:00 kumar rohit kumar.en...@gmail.com:
 
   Hello I want to build a simple website of online result using
 semantic
   web. I have started learning JSP, but not sure how can we make it
  semantic
   using JSP?
   How can we use Jena code inside my website to make it semantic?
   Thanks
  
 
 
 
  --
  Jean-Marc Vanel
  Déductions SARL - Consulting, services, training,
  Rule-based programming, Semantic Web
  http://deductions-software.com/
  +33 (0)6 89 16 29 52
  Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
 



Re: Semantic Website

2015-08-28 Thread kumar rohit
Thank you Nicolas. Do you think learning all these tools will be better for
me? I mean as I have already some basic understanding of JENA,JSP, and
SPARQL. so learning pa4rdf, jersey, spring and angularjs tools will not be
time consuming?

On Fri, Aug 28, 2015 at 1:01 PM, Nicolas Paris nipari...@gmail.com wrote:

 tutorial angularjs : http://www.w3schools.com/angular/
 pa4rdf : http://pa4rdf.sourceforge.net/index.html
 jersey/angularjs example :
 https://github.com/rkazarin/sample-jersey-webapp
 springsecurity example :
 https://github.com/philipsorst/angular-rest-springsecurity
 about one page css I use bootstrap template
 https://almsaeedstudio.com/themes/AdminLTE/index2.html






 2015-08-28 13:20 GMT+02:00 kumar rohit kumar.en...@gmail.com:

  Thank you Nicolas can you send me some literature about it just to start
  with? Also the other tools you mentioned, if you have some tutorials for
  beginners?
  regards
 
  On Fri, Aug 28, 2015 at 12:14 PM, Nicolas Paris nipari...@gmail.com
  wrote:
 
   Hello,
  
   I am building such website and after some testing I use :
   - backend : jersey rest service with jena behind, with pa4rdf to map
 java
   object as TDB triple
   - frontend : angularjs that talks with rest services
   - security with spring security
  
   If you just started jsp, you can moove on angularjs, it's works similar
   (with templates  balises ) but saves time  looks modern.
  
  
   2015-08-28 12:52 GMT+02:00 Jean-Marc Vanel jeanmarc.va...@gmail.com:
  
You may try my semantic_forms;
this is both a generic semantic web navigation and annotation
   application,
and a framework to build business apps.
   
It leverages on Jena TDB, Play! Framework and Scala.
   
   
 https://github.com/jmvanel/semantic_forms/tree/master/scala/forms_play
   
   
   
2015-08-28 12:46 GMT+02:00 kumar rohit kumar.en...@gmail.com:
   
 Hello I want to build a simple website of online result using
   semantic
 web. I have started learning JSP, but not sure how can we make it
semantic
 using JSP?
 How can we use Jena code inside my website to make it semantic?
 Thanks

   
   
   
--
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://
  irc.freenode.net#eulergui
   
  
 



Re: Semantic Website

2015-08-28 Thread kumar rohit
yes like dbpedia. Actually I am new to semantic web and need to learn tools
which I will also use in future like next semester my master thesis and of
course which will help me in my Phd research also. The online result
website I just want to develop as a sample and to grasp hands on these
tools.
Hope you have understood my position :)

On Fri, Aug 28, 2015 at 3:25 PM, Jean-Marc Vanel jeanmarc.va...@gmail.com
wrote:

 Kumar,

 if you could explain a bit more about your needs :
 simple website of online result using semantic web
 we could tell you about more alternatives.

 Do have Java classes corresponding to your RDF data ?
 Or do you have pure RDF data ?
 How do you want to present your data ? Like dbpedia or more specific to
 your app ?
 Need of user updating the data ? how ?


 2015-08-28 16:08 GMT+02:00 Nicolas Paris nipari...@gmail.com:

  I didn't know about all of that stuff  too before starting my project,
 just
  basic in java  javascript.
  I started with jsp (basic learning like you), and mooved to angularjs. It
  depends on your javascript knowledges. But with basic anderstanding of
  javascript, it took me 1 days  to anderstand angularjs and be able to
  begin.
  - Jersey web service is as easy as servlet MVC for jsp. Many tutorial to
  begin rapidly.
  - pa4rdf is great  easy to use (congratthanks to his author BTW) (look
 at
  this http://pa4rdf.sourceforge.net/examples/concreteClassSubject.html)
  - spring security can be aded at the end of the project then later...
 
  I would do it again, without dubt. It depends on your project. I have
 heard
  about http://graphityhq.com/, but I admit not to understand much about
  that
 
 
 
  2015-08-28 15:28 GMT+02:00 kumar rohit kumar.en...@gmail.com:
 
   Thank you Nicolas. Do you think learning all these tools will be better
  for
   me? I mean as I have already some basic understanding of JENA,JSP, and
   SPARQL. so learning pa4rdf, jersey, spring and angularjs tools will not
  be
   time consuming?
  
   On Fri, Aug 28, 2015 at 1:01 PM, Nicolas Paris nipari...@gmail.com
   wrote:
  
tutorial angularjs : http://www.w3schools.com/angular/
pa4rdf : http://pa4rdf.sourceforge.net/index.html
jersey/angularjs example :
https://github.com/rkazarin/sample-jersey-webapp
springsecurity example :
https://github.com/philipsorst/angular-rest-springsecurity
about one page css I use bootstrap template
https://almsaeedstudio.com/themes/AdminLTE/index2.html
   
   
   
   
   
   
2015-08-28 13:20 GMT+02:00 kumar rohit kumar.en...@gmail.com:
   
 Thank you Nicolas can you send me some literature about it just to
   start
 with? Also the other tools you mentioned, if you have some
 tutorials
   for
 beginners?
 regards

 On Fri, Aug 28, 2015 at 12:14 PM, Nicolas Paris 
 nipari...@gmail.com
  
 wrote:

  Hello,
 
  I am building such website and after some testing I use :
  - backend : jersey rest service with jena behind, with pa4rdf to
  map
java
  object as TDB triple
  - frontend : angularjs that talks with rest services
  - security with spring security
 
  If you just started jsp, you can moove on angularjs, it's works
   similar
  (with templates  balises ) but saves time  looks modern.
 
 
  2015-08-28 12:52 GMT+02:00 Jean-Marc Vanel 
  jeanmarc.va...@gmail.com
   :
 
   You may try my semantic_forms;
   this is both a generic semantic web navigation and annotation
  application,
   and a framework to build business apps.
  
   It leverages on Jena TDB, Play! Framework and Scala.
  
  
   
 https://github.com/jmvanel/semantic_forms/tree/master/scala/forms_play
  
  
  
   2015-08-28 12:46 GMT+02:00 kumar rohit kumar.en...@gmail.com
 :
  
Hello I want to build a simple website of online result
 using
  semantic
web. I have started learning JSP, but not sure how can we
 make
  it
   semantic
using JSP?
How can we use Jena code inside my website to make it
 semantic?
Thanks
   
  
  
  
   --
   Jean-Marc Vanel
   Déductions SARL - Consulting, services, training,
   Rule-based programming, Semantic Web
   http://deductions-software.com/
   +33 (0)6 89 16 29 52
   Twitter: @jmvanel , @jmvanel_fr ; chat: irc://
 irc.freenode.net#eulergui
  
 

   
  
 



 --
 Jean-Marc Vanel
 Déductions SARL - Consulting, services, training,
 Rule-based programming, Semantic Web
 http://deductions-software.com/
 +33 (0)6 89 16 29 52
 Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui



Apache Maven

2015-08-24 Thread kumar rohit
What Apache Maven in Eclipse is used for? In what type of application we
need it?
Also I have found various tutorials showing downloading, installing, and
integrating Maven in Eclipse but I think Eclipse has already Maven
installed and integrated. Is it so?


Re: Apache Maven

2015-08-24 Thread kumar rohit
what does actual development work on Jena,  means? can you differentiate
between Jena as a framework and actual development with Jena?


On Mon, Aug 24, 2015 at 4:21 PM, aj...@virginia.edu aj...@virginia.edu
wrote:

 Apache Maven is the build management system used by Jena. You will find
 info here:

 https://maven.apache.org/

 If you are just using Jena as a framework or toolkit you will probably not
 need Maven. If you intend to do actual development work on Jena, you will
 need to become familiar with Maven. Most Eclipse installs do indeed have
 Maven pre-integrated.

 ---
 A. Soroka
 The University of Virginia Library

 On Aug 24, 2015, at 10:29 AM, kumar rohit kumar.en...@gmail.com wrote:

  What Apache Maven in Eclipse is used for? In what type of application we
  need it?
  Also I have found various tutorials showing downloading, installing, and
  integrating Maven in Eclipse but I think Eclipse has already Maven
  installed and integrated. Is it so?




Re: Apache Maven

2015-08-24 Thread kumar rohit
I got it.. thanks

On Mon, Aug 24, 2015 at 5:32 PM, Colin Maudry co...@maudry.com wrote:

 Hi Kumar,

 What you describe is using Jena.

 Doing development means writing code to extend Jena  functionality with
 plugins, bug fixes, etc.

 So it seems like you don't need Maven.

 Colin

 On 24/08/2015 18:10, kumar rohit wrote:
  yes I develop ontology in Protege, import it in Jena, iterate through its
  triples, and running SPARQL queries using Jena. If this is Jena code
  writing, then what is using jena code?
  Thanks for your time.
 
 
  On Mon, Aug 24, 2015 at 4:54 PM, aj...@virginia.edu aj...@virginia.edu
  wrote:
 
  Are you _using_ Jena's code or _writing new Jena code_? The latter is
  actual development work.
 
  ---
  A. Soroka
  The University of Virginia Library
 
  On Aug 24, 2015, at 11:52 AM, kumar rohit kumar.en...@gmail.com
 wrote:
 
  what does actual development work on Jena,  means? can you
  differentiate
  between Jena as a framework and actual development with Jena?
 
 
  On Mon, Aug 24, 2015 at 4:21 PM, aj...@virginia.edu 
 aj...@virginia.edu
  wrote:
 
  Apache Maven is the build management system used by Jena. You will
 find
  info here:
 
  https://maven.apache.org/
 
  If you are just using Jena as a framework or toolkit you will probably
  not
  need Maven. If you intend to do actual development work on Jena, you
  will
  need to become familiar with Maven. Most Eclipse installs do indeed
 have
  Maven pre-integrated.
 
  ---
  A. Soroka
  The University of Virginia Library
 
  On Aug 24, 2015, at 10:29 AM, kumar rohit kumar.en...@gmail.com
  wrote:
  What Apache Maven in Eclipse is used for? In what type of application
  we
  need it?
  Also I have found various tutorials showing downloading, installing,
  and
  integrating Maven in Eclipse but I think Eclipse has already Maven
  installed and integrated. Is it so?
 
 




Re: sparql inside jena

2015-08-22 Thread kumar rohit
Student studies course, this is the statement. Individuals are Student1,
Student2, Student3(subjects) and Course2(object).
Student1, Student2, Student3 studies Course2 where some other students
studies course1.

On Sat, Aug 22, 2015 at 12:09 PM, Chris Dollin chris.dol...@epimorphics.com
 wrote:

 On 08/22/2015 11:47 AM, kumar rohit wrote:

 This code only displays Student1 where it suppose to display Student1,
 student2 and student 3 as i made the ontology in Protege so.. In protege
 it
 displays all three but here in Jena its output is:
 | var |
 ===
 | rr:Student1 |


 code is below


 Show the model and how you construct it.



 __
 String querystring=PREFIX rr:
 http://www.semanticweb.org/asadali/ontologies/2015/5/untitled-ontology-22#
 
 + SELECT  ?var \n 
 + WHERE  {
 +  ?var rr:studies rr:Course2  +  };
 Query query=QueryFactory.create(querystring);
 QueryExecution qe = QueryExecutionFactory.create(query, m);
 try {
 ResultSet results = qe.execSelect();
 ResultSetFormatter.out(System.out, results, query);
 //System.out.println(querystring);
 }


 Chris



Re: sparql inside jena

2015-08-22 Thread kumar rohit
After imports all the code in jena is here.

public class famtree {
static final String inputfile
=(C://Users//km//Desktop//Project//protege//Module.owl);

public static void main(String[] args) {
// TODO Auto-generated method stub
OntDocumentManager mgr=new OntDocumentManager();
OntModelSpec spec=new OntModelSpec(OntModelSpec.OWL_DL_MEM);
spec.setDocumentManager(mgr);
OntModel m = ModelFactory.createOntologyModel(spec,null);
//use filemanager to open ontology from file system
InputStream in=FileManager.get().open(inputfile);
if (in==null)
{
throw new IllegalArgumentException(File + inputfile + not found);
}
m.read(in,);
String querystring=PREFIX rr:
http://www.semanticweb.org/kumar/ontologies/2015/5/untitled-ontology-22#
+ SELECT  ?var \n 
+ WHERE  {
+  ?var rr:studies rr:Course2  +  };
Query query=QueryFactory.create(querystring);
QueryExecution qe = QueryExecutionFactory.create(query, m);
try {
ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out, results, query);
//System.out.println(querystring);
}
finally {
qe.close();
}

On Sat, Aug 22, 2015 at 12:35 PM, Andy Seaborne a...@apache.org wrote:

 Show the data.
 Show how you created the model.

 http://stackoverflow.com/help/mcve

 Andy


 On 22/08/15 12:15, kumar rohit wrote:

 Student studies course, this is the statement. Individuals are Student1,
 Student2, Student3(subjects) and Course2(object).
 Student1, Student2, Student3 studies Course2 where some other students
 studies course1.

 On Sat, Aug 22, 2015 at 12:09 PM, Chris Dollin 
 chris.dol...@epimorphics.com

 wrote:


 On 08/22/2015 11:47 AM, kumar rohit wrote:

 This code only displays Student1 where it suppose to display Student1,
 student2 and student 3 as i made the ontology in Protege so.. In protege
 it
 displays all three but here in Jena its output is:
 | var |
 ===
 | rr:Student1 |


 code is below


 Show the model and how you construct it.



 __
 String querystring=PREFIX rr:

 http://www.semanticweb.org/asadali/ontologies/2015/5/untitled-ontology-22#

 

 + SELECT  ?var \n 
 + WHERE  {
 +  ?var rr:studies rr:Course2  +  };
 Query query=QueryFactory.create(querystring);
 QueryExecution qe = QueryExecutionFactory.create(query, m);
 try {
 ResultSet results = qe.execSelect();
 ResultSetFormatter.out(System.out, results, query);
 //System.out.println(querystring);
 }


 Chris






Re: What is the error in code

2015-08-21 Thread kumar rohit
Thank you the syntax error removes but it gives me error xWHERE.. I know
very minor mistake but not sure where it is.

__
*String querystring=PREFIX ss:http://www.semanticweb.org
http://www.semanticweb.org +SELECT ?y +*
* WHERE { +  ?y ss:hasson ss:zia  + };*
___

On Thu, Aug 20, 2015 at 9:48 PM, Andy Seaborne a...@apache.org wrote:

 On 20/08/15 21:19, aj...@virginia.edu wrote:

 This may or may not be the entire problem, but in the line:

 String querystring=PREFIX ss:http://www.semanticweb.org; +SELECT ?x
 + WHERE { + ?x ss:hasson ss:zia + };


 you opened the angle-brackets around your namespace without closing them.


 Exactly.

  Exception in thread main com.hp.hpl.jena.query.QueryParseException:
  Encountered at line 1, column 11.


 Put some newlines into the string!

 ... and then the next error is at SELECT ?x + WHERE whch is
 SELECT ?xWHERE {

 i.e a variable called xWHERE



 ---
 A. Soroka
 The University of Virginia Library

 On Aug 20, 2015, at 4:15 PM, kumar rohit kumar.en...@gmail.com wrote:

 import java.io.InputStream;

 import com.hp.hpl.jena.ontology.OntDocumentManager;
 import com.hp.hpl.jena.ontology.OntModel;
 import com.hp.hpl.jena.ontology.OntModelSpec;
 import com.hp.hpl.jena.query.Query;
 import com.hp.hpl.jena.query.QueryExecution;
 import com.hp.hpl.jena.query.QueryExecutionFactory;
 import com.hp.hpl.jena.query.QueryFactory;
 import com.hp.hpl.jena.query.ResultSet;
 import com.hp.hpl.jena.query.ResultSetFormatter;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.util.FileManager;


 public class famtree {
 static final String inputfile =(C://Users//asad
 ali//Desktop//Project//protege//relation.owl);

 public static void main(String[] args) {
 OntDocumentManager mgr=new OntDocumentManager();

 OntModelSpec spec=new OntModelSpec(OntModelSpec.OWL_DL_MEM);

 spec.setDocumentManager(mgr);

 OntModel m = ModelFactory.createOntologyModel(spec,null);

 InputStream in=FileManager.get().open(inputfile);
 if (in==null)
 {
 throw new IllegalArgumentException(File + inputfile + not found);
 }
 m.read(in,);

 String querystring=PREFIX ss:http://www.semanticweb.org; +SELECT ?x
 +
 WHERE { + ?x ss:hasson ss:zia + };

 Query query=QueryFactory.create(querystring);

 QueryExecution qe = QueryExecutionFactory.create(query, m);

 ResultSet results = qe.execSelect();

 ResultSetFormatter.out(System.out, results, query);

 qe.close();
 }
 }

 The following error displays in Eclipse
 ___

 Exception in thread main com.hp.hpl.jena.query.QueryParseException:
 Encountered at line 1, column 11.
 Was expecting:
 IRIref ...

 at

 com.hp.hpl.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:102)
 at
 com.hp.hpl.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:53)
 at com.hp.hpl.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34)
 at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:148)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:53)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:41)
 at familytree.famtree.main(famtree.java:37)






Re: What is the error in code

2015-08-21 Thread kumar rohit
I did with System.out.print(querystring) and the output is:

PREFIX ss:http://www.semanticweb.orgSELECT ?y  WHERE  { ?y ss:hasson
ss:zia }

On Fri, Aug 21, 2015 at 9:59 AM, Lorenz Bühmann 
buehm...@informatik.uni-leipzig.de wrote:

 Hello Kumar,

 why don't you print the query string in Java first to the console using
 System.out.println(queryString); ? Then you will see how your concatenated
 string looks like and that there is a missing space after ?y resp. before
 WHERE.

 Kind regards,
 Lorenz

 Thank you the syntax error removes but it gives me error xWHERE.. I know
 very minor mistake but not sure where it is.

 __
 *String querystring=PREFIX ss:http://www.semanticweb.org
 http://www.semanticweb.org +SELECT ?y +*
 * WHERE { +  ?y ss:hasson ss:zia  + };*


 ___

 On Thu, Aug 20, 2015 at 9:48 PM, Andy Seaborne a...@apache.org wrote:

 On 20/08/15 21:19, aj...@virginia.edu wrote:

 This may or may not be the entire problem, but in the line:

 String querystring=PREFIX ss:http://www.semanticweb.org; +SELECT ?x

 + WHERE { + ?x ss:hasson ss:zia + };

 you opened the angle-brackets around your namespace without closing
 them.

 Exactly.

 Exception in thread main com.hp.hpl.jena.query.QueryParseException:
 Encountered at line 1, column 11.


 Put some newlines into the string!

 ... and then the next error is at SELECT ?x + WHERE whch is
 SELECT ?xWHERE {

 i.e a variable called xWHERE



 ---
 A. Soroka
 The University of Virginia Library

 On Aug 20, 2015, at 4:15 PM, kumar rohit kumar.en...@gmail.com wrote:

 import java.io.InputStream;

 import com.hp.hpl.jena.ontology.OntDocumentManager;
 import com.hp.hpl.jena.ontology.OntModel;
 import com.hp.hpl.jena.ontology.OntModelSpec;
 import com.hp.hpl.jena.query.Query;
 import com.hp.hpl.jena.query.QueryExecution;
 import com.hp.hpl.jena.query.QueryExecutionFactory;
 import com.hp.hpl.jena.query.QueryFactory;
 import com.hp.hpl.jena.query.ResultSet;
 import com.hp.hpl.jena.query.ResultSetFormatter;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.util.FileManager;


 public class famtree {
 static final String inputfile =(C://Users//asad
 ali//Desktop//Project//protege//relation.owl);

 public static void main(String[] args) {
 OntDocumentManager mgr=new OntDocumentManager();

 OntModelSpec spec=new OntModelSpec(OntModelSpec.OWL_DL_MEM);

 spec.setDocumentManager(mgr);

 OntModel m = ModelFactory.createOntologyModel(spec,null);

 InputStream in=FileManager.get().open(inputfile);
 if (in==null)
 {
 throw new IllegalArgumentException(File + inputfile + not found);
 }
 m.read(in,);

 String querystring=PREFIX ss:http://www.semanticweb.org; +SELECT
 ?x
 +
 WHERE { + ?x ss:hasson ss:zia + };

 Query query=QueryFactory.create(querystring);

 QueryExecution qe = QueryExecutionFactory.create(query, m);

 ResultSet results = qe.execSelect();

 ResultSetFormatter.out(System.out, results, query);

 qe.close();
 }
 }

 The following error displays in Eclipse
 ___

 Exception in thread main com.hp.hpl.jena.query.QueryParseException:
 Encountered at line 1, column 11.
 Was expecting:
  IRIref ...

 at


 com.hp.hpl.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:102)
 at

 com.hp.hpl.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:53)
 at com.hp.hpl.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34)
 at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:148)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:53)
 at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:41)
 at familytree.famtree.main(famtree.java:37)


 --
 Lorenz Bühmann
 AKSW group, University of Leipzig
 Group: http://aksw.org - semantic web research center




  1   2   >