You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Archana kumar <ar...@gmail.com> on 2011/03/08 07:23:41 UTC

Help required please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Hi,

I have a file user.rdf which has the following:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:kb="http://protege.stanford.edu/kb#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
    <rdf:Description rdf:about="http://protege.stanford.edu/kb#Suresh">
    <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
    <kb:Email>suresh_345@yahoo.co.in</kb:Email>
    <kb:Fname>Suresh</kb:Fname>
    <kb:Interest>Java</kb:Interest>
    <kb:Occupation>Agent</kb:Occupation>
    <kb:Password>suresh</kb:Password>
    <kb:Uname>sur</kb:Uname>
    <rdfs:label>Suresh</rdfs:label>
  </rdf:Description>
   <rdf:Description rdf:about="http://protege.stanford.edu/kb#Anvika">
    <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
    <kb:Email>anu@gmail.com</kb:Email>
    <kb:Fname>Anvika</kb:Fname>
    <kb:Interest>C language</kb:Interest>
    <kb:Occupation>Student</kb:Occupation>
    <kb:Password>anu</kb:Password>
    <kb:Uname>anvika</kb:Uname>
    <rdfs:label>Anvika</rdfs:label>
  </rdf:Description>
</rdf:RDF>


This file is created in Protege. Then this file is deployed in a web
application in Eclipse.

In my applicaition I have used Schemagen to create the initial settings. The
application uses Java and Jena as front end where the users are supposed to
update their profile through the front end. With help of Jena the different
properties and their values are added into the user.rdf through the
application. But the only line missing in the updated in the rdf file is
<rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>.

I need to use this line as a part of inference. How do I add this line in
the rdf file through the application.

The rules for the inference uses the following code:

@prefix kb: http://protege.stanford.edu/kb#
[likec++: (?s rdf:type kb:LikeC++)
           <-
          (?s rdf:type kb:USER)
          (?s kb:Interest ?i)
          print(?s)
          print(?i)
          regex(?i,'C language')


]


I need to match all the rdf:type tags with my tags in user.rdf. Since that
line is not getting updated through the application I am not able to
continue.

The updated user.rdf is as follows:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:kb="http://protege.stanford.edu/kb#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
   <rdf:Description rdf:about="http://protege.stanford.edu/kb#Somanch">
    <kb:Email>asom@gmail.com</kb:Email>
    <kb:Name>Somanch</kb:Name>
    <kb:Password>henry</kb:Password>
    <kb:Uname>soman</kb:Uname>
    <kb:Interest>C Language</kb:Interest>
    <kb:Occupation>Student</kb:Occupation>
  </rdf:Description>
  <rdf:Description rdf:about="http://protege.stanford.edu/kb#Suresh">
    <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
    <kb:Email>suresh_345@yahoo.co.in</kb:Email>
    <kb:Fname>Suresh</kb:Fname>
    <kb:Interest>Java</kb:Interest>
    <kb:Occupation>Agent</kb:Occupation>
    <kb:Password>suresh</kb:Password>
    <kb:Uname>sur</kb:Uname>
    <rdfs:label>Suresh</rdfs:label>
  </rdf:Description>
   <rdf:Description rdf:about="http://protege.stanford.edu/kb#Anvika">
    <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
    <kb:Email>anu@gmail.com</kb:Email>
    <kb:Fname>Anvika</kb:Fname>
    <kb:Interest>C language</kb:Interest>
    <kb:Occupation>Student</kb:Occupation>
    <kb:Password>anu</kb:Password>
    <kb:Uname>anvika</kb:Uname>
    <rdfs:label>Anvika</rdfs:label>
  </rdf:Description>
</rdf:RDF>


Please help it is very urgent since my project deadline is nearing.......

Regards,
Archana.

Re: Help required please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posted by Dave Reynolds <da...@gmail.com>.
So you have some Java code which uses Jena to add assertions to a model
and one assertion (rdf:type kb:USER) is missing, right?

Since you haven't shown us any of that code it is pretty hard to help.

My advice would be to try to isolate the code that does the update,
ideally making it separate from the surrounding web application for
testing, and work through where the assert is supposed to happen. You'll
probably find some simple error.  If you can't track it down then post
the code that is making the assertions in the most succinct,
self-contained way you can (don't just post your entire application!)
and maybe someone will be able to help.

Dave

On Tue, 2011-03-08 at 11:53 +0530, Archana kumar wrote: 
> Hi,
> 
> I have a file user.rdf which has the following:
> 
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:kb="http://protege.stanford.edu/kb#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
>     <rdf:Description rdf:about="http://protege.stanford.edu/kb#Suresh">
>     <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
>     <kb:Email>suresh_345@yahoo.co.in</kb:Email>
>     <kb:Fname>Suresh</kb:Fname>
>     <kb:Interest>Java</kb:Interest>
>     <kb:Occupation>Agent</kb:Occupation>
>     <kb:Password>suresh</kb:Password>
>     <kb:Uname>sur</kb:Uname>
>     <rdfs:label>Suresh</rdfs:label>
>   </rdf:Description>
>    <rdf:Description rdf:about="http://protege.stanford.edu/kb#Anvika">
>     <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
>     <kb:Email>anu@gmail.com</kb:Email>
>     <kb:Fname>Anvika</kb:Fname>
>     <kb:Interest>C language</kb:Interest>
>     <kb:Occupation>Student</kb:Occupation>
>     <kb:Password>anu</kb:Password>
>     <kb:Uname>anvika</kb:Uname>
>     <rdfs:label>Anvika</rdfs:label>
>   </rdf:Description>
> </rdf:RDF>
> 
> 
> This file is created in Protege. Then this file is deployed in a web
> application in Eclipse.
> 
> In my applicaition I have used Schemagen to create the initial settings. The
> application uses Java and Jena as front end where the users are supposed to
> update their profile through the front end. With help of Jena the different
> properties and their values are added into the user.rdf through the
> application. But the only line missing in the updated in the rdf file is
> <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>.
> 
> I need to use this line as a part of inference. How do I add this line in
> the rdf file through the application.
> 
> The rules for the inference uses the following code:
> 
> @prefix kb: http://protege.stanford.edu/kb#
> [likec++: (?s rdf:type kb:LikeC++)
>            <-
>           (?s rdf:type kb:USER)
>           (?s kb:Interest ?i)
>           print(?s)
>           print(?i)
>           regex(?i,'C language')
> 
> 
> ]
> 
> 
> I need to match all the rdf:type tags with my tags in user.rdf. Since that
> line is not getting updated through the application I am not able to
> continue.
> 
> The updated user.rdf is as follows:
> 
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:kb="http://protege.stanford.edu/kb#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
>    <rdf:Description rdf:about="http://protege.stanford.edu/kb#Somanch">
>     <kb:Email>asom@gmail.com</kb:Email>
>     <kb:Name>Somanch</kb:Name>
>     <kb:Password>henry</kb:Password>
>     <kb:Uname>soman</kb:Uname>
>     <kb:Interest>C Language</kb:Interest>
>     <kb:Occupation>Student</kb:Occupation>
>   </rdf:Description>
>   <rdf:Description rdf:about="http://protege.stanford.edu/kb#Suresh">
>     <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
>     <kb:Email>suresh_345@yahoo.co.in</kb:Email>
>     <kb:Fname>Suresh</kb:Fname>
>     <kb:Interest>Java</kb:Interest>
>     <kb:Occupation>Agent</kb:Occupation>
>     <kb:Password>suresh</kb:Password>
>     <kb:Uname>sur</kb:Uname>
>     <rdfs:label>Suresh</rdfs:label>
>   </rdf:Description>
>    <rdf:Description rdf:about="http://protege.stanford.edu/kb#Anvika">
>     <rdf:type rdf:resource="http://protege.stanford.edu/kb#USER"/>
>     <kb:Email>anu@gmail.com</kb:Email>
>     <kb:Fname>Anvika</kb:Fname>
>     <kb:Interest>C language</kb:Interest>
>     <kb:Occupation>Student</kb:Occupation>
>     <kb:Password>anu</kb:Password>
>     <kb:Uname>anvika</kb:Uname>
>     <rdfs:label>Anvika</rdfs:label>
>   </rdf:Description>
> </rdf:RDF>
> 
> 
> Please help it is very urgent since my project deadline is nearing.......
> 
> Regards,
> Archana.