|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with "project.show(instanceName) statement ???I get the following error when trying to run the code below: Exception in thread "main" java.lang.AssertionError: instance at edu.stanford.smi.protege.util.Assert.assertNotNull(Unknown Source) at edu.stanford.smi.protege.model.Project.show(Unknown Source) at edu.stanford.smi.protege.model.Project.show(Unknown Source) at MyExternalApplication.main(MyExternalApplication.java:27) Line 27 is the "project.show(instanceName)" I can find absolutely nothing wrong with this statment based on usage described in the javadoc for the API. Any help would be greatly appreciated. Regards, Ben CODE: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author bburgis */ import java.util.*; import javax.swing.*; import edu.stanford.smi.protege.model.*; public class MyExternalApplication { private static String projectFileName = "C:/Documents/AuroraImages.pprj"; private static String instanceName = "PolarVIS_EarthCamera"; public static void main(String[] args) { Collection errors = new ArrayList(); Project project = Project.loadProjectFromFile(projectFileName, errors); if (errors.isEmpty()) { // show an instance in a top level frame project.show(instanceName); // create a panel that contains and instance form and display it in my top level frame Instance instance = project.getKnowledgeBase().getInstance(instanceName); JComponent panel = (JComponent) project.createRuntimeClsWidget(instance); JFrame frame = new JFrame("Aurora Image Instance"); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); } else { System.out.println("There were load errors"); } } } Making the world a better place one message at a time. Check out the i'm Talkathon. Use video conversation to talk face-to-face with Windows Live Messenger. Get started. _______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
|
|
Re: Problem with "project.show(instanceName) statement ???Benjamin,
project.show takes as argument an Instance object, not a String object. So, your call should be something like this: project.show(instance) Move this line after the line where you create the instance. Tania Benjamin Burgis wrote: > > I get the following error when trying to run the code below: > > Exception in thread "main" java.lang.AssertionError: instance > at edu.stanford.smi.protege.util.Assert.assertNotNull(Unknown > Source) > at edu.stanford.smi.protege.model.Project.show(Unknown Source) > at edu.stanford.smi.protege.model.Project.show(Unknown Source) > at MyExternalApplication.main(MyExternalApplication.java:27) > > Line 27 is the "project.show(instanceName)" > I can find absolutely nothing wrong with this statment based on usage > described in the javadoc for the API. > Any help would be greatly appreciated. > > Regards, > > Ben > > > > CODE: > > /* > * To change this template, choose Tools | Templates > * and open the template in the editor. > */ > /** > * > * @author bburgis > */ > import java.util.*; > import javax.swing.*; > import edu.stanford.smi.protege.model.*; > public class MyExternalApplication { > private static String projectFileName = > "C:/Documents/AuroraImages.pprj"; > private static String instanceName = "PolarVIS_EarthCamera"; > public static void main(String[] args) { > Collection errors = new ArrayList(); > Project project = Project.loadProjectFromFile(projectFileName, > errors); > if (errors.isEmpty()) { > // show an instance in a top level frame > project.show(instanceName); > // create a panel that contains and instance form and > display it in my top level frame > Instance instance = > project.getKnowledgeBase().getInstance(instanceName); > JComponent panel = (JComponent) > project.createRuntimeClsWidget(instance); > JFrame frame = new JFrame("Aurora Image Instance"); > frame.getContentPane().add(panel); > frame.pack(); > frame.setVisible(true); > } else { > System.out.println("There were load errors"); > } > } > } > > > > > ------------------------------------------------------------------------ > Making the world a better place one message at a time. Check out the > i'm Talkathon. > <http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace> > ------------------------------------------------------------------------ > Use video conversation to talk face-to-face with Windows Live > Messenger. Get started. > <http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008> > > ------------------------------------------------------------------------ > > _______________________________________________ > protege-owl mailing list > protege-owl@... > 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@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
| Free Forum Powered by Nabble | Forum Help |