[protege-owl] repository problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[protege-owl] repository problem

Selvanayaki M.

hi  

     i create swrl rule using SWRLFactory.i am using protege 3.2 beta
build 327. i  am using eclipse 3.2.i put the swrl.owl and swrlb.owl in
eclipse plugins directory.i am using  the following code to create swrl
rule.

SWRLDatavaluedPropertyAtom hasvaluePropertyAtom,resultPropertyAtom;
                SWRLAtomList body, head;
                SWRLImp imp;
                Vector errors = new Vector();
                String file="/usr/local/Protege_3.2_beta/swrlrules.owl";
                String urii = "file:///usr/local/Protege_3.2_beta/swrlrules.owl";
                try
                {
                //create uri
                OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(urii);
                //create pressure class atom
                SWRLClassAtom classatom;
                OWLNamedClass pressureclass;
                pressureclass=owlModel.getOWLNamedClass("pressure");
                SWRLFactory factory = new SWRLFactory(owlModel);
                SWRLVariable x1= factory.createVariable("x1");
                classatom=factory.createClassAtom(pressureclass,x1);
                //code for has_value(?x1,"low")
                RDFSLiteral low=owlModel.createRDFSLiteral("low");
                OWLDatatypeProperty
has_value=owlModel.getOWLDatatypeProperty("has_value");
                hasvaluePropertyAtom=factory.createDatavaluedPropertyAtom(has_value,x1,low);
                //code for has_result(?x1,"intimate");
                RDFSLiteral intimate=owlModel.createRDFSLiteral("intimate");
                OWLDatatypeProperty
has_result=owlModel.getOWLDatatypeProperty("has_result");
                resultPropertyAtom=factory.createDatavaluedPropertyAtom(has_result,x1,intimate);
                //add the atom to body and head
                body=factory.createAtomList();
                head=factory.createAtomList();
                head.append(classatom);
                head.append(hasvaluePropertyAtom);
                body.append(resultPropertyAtom);
                imp=factory.createImp(body,head);
                System.out.println("rule created");
                 //save the Model
        JenaOWLModel owl=(JenaOWLModel) owlModel;
        System.out.println("befor rule saving");
       
        System.out.println(new File(file).toURI());
       
        OntModel ontModel = owl.getOntModel();
       
            owl.save(new File(file).toURI(), FileUtils.langXMLAbbrev, new
HashSet(),ontModel);
            System.out.println("after rule saved");
       


when i run this program the ADDRepository screen opens and ask to add
repository file.but i already put the repository files in plugins dir.why
it asks the repository files each time the program execution.what  i do to
clear this error.



thanks in advance,
Selva
             



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: repository problem

Martin O'Connor

To enable Protege-OWL to work properly within Eclipse you will need to
created a subdirectory of your Eclipse plugins directory called
"edu.stanford.smi.protegex.owl" and place the JARs and OWL files from
the standard Protege-OWL plugins directory into that subdirectory.
Protege-OWL should then be able to find the repository files from within
Eclipse.

Martin

Selvanayaki M. wrote:

>hi  
>
>     i create swrl rule using SWRLFactory.i am using protege 3.2 beta
>build 327. i  am using eclipse 3.2.i put the swrl.owl and swrlb.owl in
>eclipse plugins directory.i am using  the following code to create swrl
>rule.
>
>SWRLDatavaluedPropertyAtom hasvaluePropertyAtom,resultPropertyAtom;
> SWRLAtomList body, head;
> SWRLImp imp;
> Vector errors = new Vector();
> String file="/usr/local/Protege_3.2_beta/swrlrules.owl";
> String urii = "file:///usr/local/Protege_3.2_beta/swrlrules.owl";
> try
> {
> //create uri
> OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(urii);
> //create pressure class atom
> SWRLClassAtom classatom;
> OWLNamedClass pressureclass;
> pressureclass=owlModel.getOWLNamedClass("pressure");
> SWRLFactory factory = new SWRLFactory(owlModel);
> SWRLVariable x1= factory.createVariable("x1");
> classatom=factory.createClassAtom(pressureclass,x1);
> //code for has_value(?x1,"low")
> RDFSLiteral low=owlModel.createRDFSLiteral("low");
> OWLDatatypeProperty
>has_value=owlModel.getOWLDatatypeProperty("has_value");
> hasvaluePropertyAtom=factory.createDatavaluedPropertyAtom(has_value,x1,low);
> //code for has_result(?x1,"intimate");
> RDFSLiteral intimate=owlModel.createRDFSLiteral("intimate");
> OWLDatatypeProperty
>has_result=owlModel.getOWLDatatypeProperty("has_result");
> resultPropertyAtom=factory.createDatavaluedPropertyAtom(has_result,x1,intimate);
> //add the atom to body and head
> body=factory.createAtomList();
> head=factory.createAtomList();
> head.append(classatom);
> head.append(hasvaluePropertyAtom);
> body.append(resultPropertyAtom);
> imp=factory.createImp(body,head);
> System.out.println("rule created");
> //save the Model
>        JenaOWLModel owl=(JenaOWLModel) owlModel;
>        System.out.println("befor rule saving");
>        
>        System.out.println(new File(file).toURI());
>        
>        OntModel ontModel = owl.getOntModel();
>        
>    owl.save(new File(file).toURI(), FileUtils.langXMLAbbrev, new
>HashSet(),ontModel);
>    System.out.println("after rule saved");
>
>
>
>when i run this program the ADDRepository screen opens and ask to add
>repository file.but i already put the repository files in plugins dir.why
>it asks the repository files each time the program execution.what  i do to
>clear this error.
>
>
>
>thanks in advance,
>Selva
>      
>
>
>
>-------------------------------------------------------------------------
>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: repository problem

Selvanayaki M.
Thanks Martin.I followed your instructions and it works fine.


cheers,
Selva



On Tue, Aug 8, 2006, Martin O'Connor <[hidden email]> said:

>
> To enable Protege-OWL to work properly within Eclipse you will need to
> created a subdirectory of your Eclipse plugins directory called
> "edu.stanford.smi.protegex.owl" and place the JARs and OWL files from
> the standard Protege-OWL plugins directory into that subdirectory.
> Protege-OWL should then be able to find the repository files from within
> Eclipse.
>
> Martin
>
> Selvanayaki M. wrote:
>
>>hi  
>>
>>     i create swrl rule using SWRLFactory.i am using protege 3.2 beta
>>build 327. i  am using eclipse 3.2.i put the swrl.owl and swrlb.owl in
>>eclipse plugins directory.i am using  the following code to create swrl
>>rule.
>>
>>SWRLDatavaluedPropertyAtom hasvaluePropertyAtom,resultPropertyAtom;
>> SWRLAtomList body, head;
>> SWRLImp imp;
>> Vector errors = new Vector();
>> String file="/usr/local/Protege_3.2_beta/swrlrules.owl";
>> String urii = "file:///usr/local/Protege_3.2_beta/swrlrules.owl";
>> try
>> {
>> //create uri
>> OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(urii);
>> //create pressure class atom
>> SWRLClassAtom classatom;
>> OWLNamedClass pressureclass;
>> pressureclass=owlModel.getOWLNamedClass("pressure");
>> SWRLFactory factory = new SWRLFactory(owlModel);
>> SWRLVariable x1= factory.createVariable("x1");
>> classatom=factory.createClassAtom(pressureclass,x1);
>> //code for has_value(?x1,"low")
>> RDFSLiteral low=owlModel.createRDFSLiteral("low");
>> OWLDatatypeProperty
>>has_value=owlModel.getOWLDatatypeProperty("has_value");
>> hasvaluePropertyAtom=factory.createDatavaluedPropertyAtom(has_value,x1,low);
>> //code for has_result(?x1,"intimate");
>> RDFSLiteral intimate=owlModel.createRDFSLiteral("intimate");
>> OWLDatatypeProperty
>>has_result=owlModel.getOWLDatatypeProperty("has_result");
>> resultPropertyAtom=factory.createDatavaluedPropertyAtom(has_result,x1,intimate);
>> //add the atom to body and head
>> body=factory.createAtomList();
>> head=factory.createAtomList();
>> head.append(classatom);
>> head.append(hasvaluePropertyAtom);
>> body.append(resultPropertyAtom);
>> imp=factory.createImp(body,head);
>> System.out.println("rule created");
>> //save the Model
>>        JenaOWLModel owl=(JenaOWLModel) owlModel;
>>        System.out.println("befor rule saving");
>>        
>>        System.out.println(new File(file).toURI());
>>        
>>        OntModel ontModel = owl.getOntModel();
>>        
>>    owl.save(new File(file).toURI(), FileUtils.langXMLAbbrev, new
>>HashSet(),ontModel);
>>    System.out.println("after rule saved");
>>
>>
>>
>>when i run this program the ADDRepository screen opens and ask to add
>>repository file.but i already put the repository files in plugins dir.why
>>it asks the repository files each time the program execution.what  i do to
>>clear this error.
>>
>>
>>
>>thanks in advance,
>>Selva
>>      
>>
>>
>>
>>-------------------------------------------------------------------------
>>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>>
>>
>>  
>>
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>

--



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: repository problem

Nikolaj Berntsen
In reply to this post by Martin O'Connor
Martin O'Connor wrote:
>
> To enable Protege-OWL to work properly within Eclipse you will need to
> created a subdirectory of your Eclipse plugins directory called
> "edu.stanford.smi.protegex.owl" and place the JARs and OWL files from
> the standard Protege-OWL plugins directory into that subdirectory.
> Protege-OWL should then be able to find the repository files from within
> Eclipse.

Are you implying that protege-owl can also masquerade as an eclipse
plugin as well as a stand alone application? If so, where is that described?

Cheers,
/\/ikolaj
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: repository problem

Nikolaj Berntsen
Nikolaj Berntsen wrote:

> Martin O'Connor wrote:
>> To enable Protege-OWL to work properly within Eclipse you will need to
>> created a subdirectory of your Eclipse plugins directory called
>> "edu.stanford.smi.protegex.owl" and place the JARs and OWL files from
>> the standard Protege-OWL plugins directory into that subdirectory.
>> Protege-OWL should then be able to find the repository files from within
>> Eclipse.
>
> Are you implying that protege-owl can also masquerade as an eclipse
> plugin as well as a stand alone application? If so, where is that described?

Thinking about it for a second - you only gave instructions how to
compile protege-owl source code. (at least there was no plugin.xml in
edu.stanford.smi.protegex.owl).

/\/

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html