Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] delete indivuduals

farzit achraff13 at hotmail.fr
Thu Mar 19 12:33:16 PDT 2009



this is the code actually running, I didn't remove any parts of it. How can
I save the ontology using  java api calls, have you an example?


Thomas Russ wrote:
> 
> 
> On Mar 19, 2009, at 7:09 AM, farzit wrote:
> 
>>
>> I saved my ontology and I opened the project with protégé but the  
>> element has
>> not been deleted.
>> I saved it before I exit my program but I have always the element  
>> "Rayon".
> 
> The code you posted below does not have anything in it that saves the  
> changes you make.  Is that the code you are actually running, or did  
> you remove parts of it before posting?
> 
> 
>>
>> even after program running the ontology file has not been changed.
>> I don't really understand
>>
>>
>> Thomas Russ wrote:
>>>
>>> You never save the ontology after deleting the individual.
>>>
>>> So the individual is only deleted in the in-memory version of the
>>> ontology.  Since you never save that change, when you start again,  
>>> you
>>> are always loading the same, unchanged file.
>>>
>>> You will need to save before you exit your program.  Otherwise any
>>> changes you make will be lost.
>>>
>>> On Mar 18, 2009, at 3:22 AM, farzit wrote:
>>>
>>>>
>>>> my program code is:
>>>>
>>>> import java.io.File;
>>>> import java.util.Collection;
>>>> import java.util.Iterator;
>>>>
>>>> import edu.stanford.smi.protegex.owl.ProtegeOWL;
>>>> import
>>>> edu 
>>>> .stanford.smi.protegex.owl.inference.dig.DefaultProtegeDIGReasoner;
>>>> import
>>>> edu
>>>> .stanford 
>>>> .smi.protegex.owl.inference.pellet.ProtegePelletJenaReasoner;
>>>> import
>>>> edu
>>>> .stanford
>>>> .smi.protegex.owl.inference.pellet.ProtegePelletOWLAPIReasoner;
>>>> import
>>>> edu.stanford.smi.protegex.owl.inference.protegeowl.ReasonerManager;
>>>> import
>>>> edu.stanford.smi.protegex.owl.inference.reasoner.ProtegeReasoner;
>>>> import edu.stanford.smi.protegex.owl.model.OWLIndividual;
>>>> import edu.stanford.smi.protegex.owl.model.OWLModel;
>>>> import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>>>> import edu.stanford.smi.protegex.owl.model.query.QueryResults;
>>>> import com.hp.hpl.jena.*;
>>>> import com.hp.hpl.jena.graph.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.ResultSetFormatter;
>>>> import com.hp.hpl.jena.rdf.model.Model;
>>>> import com.hp.hpl.jena.rdf.model.ModelFactory;
>>>> import com.hp.hpl.jena.vocabulary.ResultSet;
>>>> import javax.swing.JDesktopPane;
>>>> import javax.swing.JFrame;
>>>> import javax.swing.SwingUtilities;
>>>>
>>>> import java.util.Map;
>>>> import java.io.*;
>>>>
>>>> public class ProtegeReasonerExample {
>>>> 	public static void main (String[] args)
>>>> 	{
>>>> final String
>>>> ONTOLOGY_URL="file:///C:/ontologies/Protege_3.4_beta/reuses.owl";
>>>> try {
>>>> 			// Load the ontology from the specified URL
>>>> 	
>>>> 			OWLModel owlModel =
>>>> ProtegeOWL.createJenaOWLModelFromURI(ONTOLOGY_URL);
>>>>
>>>>
>>>> QueryResults resultsss = owlModel.executeSPARQLQuery("PREFIX
>>>> reuses:<http://www.owl-ontologies.com/reuses.owl#> SELECT ?
>>>> hasnameelemnt
>>>> WHERE { ?Element reuses:hasnameelement ?hasnameelemnt}");
>>>> 		       while( resultsss.hasNext()){
>>>> 					Map map=resultsss.next();
>>>> 					System.out.println(map.toString());
>>>> 				    }
>>>> 		
>>>> 	        OWLIndividual yourIndividual =
>>>> (OWLIndividual)owlModel.getOWLIndividual("Rayon");
>>>> 	
>>>> 	        try{
>>>> 	        	
>>>> 	          if(yourIndividual != null)
>>>> 	          {
>>>> 	
>>>> 	            yourIndividual.delete();
>>>> 	            System.out.println("::::::::::////////////::::::::");
>>>> 		        QueryResults resultsss1 =
>>>> owlModel.executeSPARQLQuery("PREFIX
>>>> reuses:<http://www.owl-ontologies.com/reuses.owl#> SELECT ?
>>>> hasnameelemnt
>>>> WHERE { ?Element reuses:hasnameelement ?hasnameelemnt}");
>>>> 			       while( resultsss1.hasNext()){
>>>> 						Map map=resultsss1.next();
>>>> 						System.out.println(map.toString());
>>>> 					    }
>>>> 	          }
>>>> 	          else System.out.println("try later");
>>>> 	
>>>> 	        }catch(NullPointerException e) {
>>>> 	          e.printStackTrace();
>>>> 	        }
>>>> 	
>>>>
>>>> } catch (Exception e) {	
>>>> 			e.printStackTrace();
>>>> 		} 		
>>>> 	}
>>>>
>>>> }
>>>>
>>>>
>>>> I made resultsss and resultsss1 to be sure that "Rayon" was deleted,
>>>> the
>>>> program works very
>>>> well. but when I open the file to save it, I find the element  
>>>> "Rayon".
>>>> and when I execute many onces the program i have always the same
>>>> result (it
>>>> recorgnise "Rayon" (normally it shoudn't because it was deleted the
>>>> first
>>>> once and  after that it deletes it)
>>>> PS: there is only one file, one project "reuses"
>>>>
>>>>
>>>>
>>>> Tania Tudorache wrote:
>>>>>
>>>>> Probably save is missing.
>>>>>
>>>>> Please upgrade to Protege 3.4 release, rather than using the beta
>>>>> version.
>>>>>
>>>>> Tania
>>>>>
>>>>> Maria M. wrote:
>>>>>> If your ontology is stored in a file, do you save the updated
>>>>>> ontology
>>>>>> (the one that does not consist the individual)?
>>>>>> This example works in my case...
>>>>>>
>>>>>> Maria
>>>>>>
>>>>>> On Tue, Mar 17, 2009 at 7:12 PM, farzit <achraff13 at hotmail.fr
>>>>>> <mailto:achraff13 at hotmail.fr>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   I tried your example, the program recognised "your
>>>>>> Individual" (in
>>>>>>   my case
>>>>>>   it is called "student1") but when i open my project this
>>>>>>   individual is not
>>>>>>   deleted.
>>>>>>   i don't know why
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Maria M. wrote:
>>>>>>>
>>>>>>> OWLIndividual yourIndividual =
>>>>>>> (OWLIndividual)owlModel.getOWLIndividual("yourIndividual");
>>>>>>> try{
>>>>>>> if(yourIndividual != null)
>>>>>>>   yourIndividual.delete();
>>>>>>> }catch(NullPointerException e) {
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>>
>>>>>>> On Tue, Mar 17, 2009 at 3:52 PM, farzit <achraff13 at hotmail.fr
>>>>>>   <mailto:achraff13 at hotmail.fr>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Hi all,
>>>>>>>> I'm working with protege 3.4 beta and and i'm implementing a  
>>>>>>>> java
>>>>>>>> application to delete some individuals.
>>>>>>>> is it possible? how can I do this? do you have an example?
>>>>>>>> Thanks
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/delete-indivuduals- 
>>>>>>>> tp22559077p22559077.html
>>>>>>>> Sent from the Protege - OWL mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> protege-owl mailing list
>>>>>>>> protege-owl at lists.stanford.edu
>>>>>>   <mailto:protege-owl at lists.stanford.edu>
>>>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>>>>
>>>>>>>> Instructions for unsubscribing:
>>>>>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> protege-owl mailing list
>>>>>>> protege-owl at lists.stanford.edu
>>>>>>   <mailto:protege-owl at lists.stanford.edu>
>>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>>>
>>>>>>> Instructions for unsubscribing:
>>>>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>   --
>>>>>>   View this message in context:
>>>>>>   http://www.nabble.com/delete-indivuduals- 
>>>>>> tp22559077p22563857.html
>>>>>>   Sent from the Protege - OWL mailing list archive at Nabble.com.
>>>>>>
>>>>>>   _______________________________________________
>>>>>>   protege-owl mailing list
>>>>>>   protege-owl at lists.stanford.edu
>>>>>> <mailto:protege-owl at lists.stanford.edu>
>>>>>>   https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>>
>>>>>>   Instructions for unsubscribing:
>>>>>>   http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> protege-owl mailing list
>>>>>> protege-owl at lists.stanford.edu
>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>>
>>>>>> Instructions for unsubscribing:
>>>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> protege-owl mailing list
>>>>> protege-owl at lists.stanford.edu
>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>
>>>>> Instructions for unsubscribing:
>>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/delete-indivuduals-tp22559077p22576141.html
>>>> Sent from the Protege - OWL mailing list archive at Nabble.com.
>>>>
>>>> _______________________________________________
>>>> protege-owl mailing list
>>>> protege-owl at lists.stanford.edu
>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>
>>>> Instructions for unsubscribing:
>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>> _______________________________________________
>>> protege-owl mailing list
>>> protege-owl at lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>
>>> Instructions for unsubscribing:
>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/delete-indivuduals-tp22559077p22600979.html
>> Sent from the Protege - OWL mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> protege-owl mailing list
>> protege-owl at lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>
>> Instructions for unsubscribing:
>> http://protege.stanford.edu/doc/faq.html#01a.03
> 
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
> 
> Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03 
> 
> 

-- 
View this message in context: http://www.nabble.com/delete-indivuduals-tp22559077p22607777.html
Sent from the Protege - OWL mailing list archive at Nabble.com.




More information about the protege-owl mailing list