140 likes | 275 Views
Working with the Ontos Architecture. Where we’re going What you should know. Overview. Current and future architecture Backwards compatibility Working with OSMX documents CVS techniques Java tips, resources, best practices. Current Architecture. Ontologies: OSM-L, osm.dtd
E N D
Working with the Ontos Architecture Where we’re going What you should know
Overview • Current and future architecture • Backwards compatibility • Working with OSMX documents • CVS techniques • Java tips, resources, best practices
Current Architecture • Ontologies: OSM-L, osm.dtd • Ontology Editor • Data Frames rev. 2 support • Runs as applet or standalone app • Automatic layout algorithm • Reads osm.dtd-based docs • Writes to various formats (OSM-L, osm.dtd, PostScript) • Ontos • Handles XML and RDF as well as old files • Produces SQL insert statements • OSM-L parser, record boundary detector, etc.
Future Architecture • Ontologies: OSMX (XML Schema) • Store data directly with ontology • Ontology Editor • Support new data frames ideas • Multiple phrases with confidence values • Specification of data types and units of measure • Methods • Import old files; write OSMX • Data frame library management • Ontos • Gen/spec working with data frames • Work with new extraction framework
Backwards Compatibility • We don’t want to lose or have to re-create old ontologies • Choice: support old or convert them? • Support could be difficult over time • Conversion: auto, manual, hybrid? • XML Transform (XSLT) will help with conversion but not all the way • Manual: tedious, one-time effort • How many ontologies are we talking about?
Working with OSMX • Reading and writing OSMX: • Use JAXB-generated classes // First get a JAXBContext instance from the factory method // Pass in the package containing the binding classes JAXBContext ctxt = JAXBContext.newInstance("edu.byu.deg.osmx.binding"); // We now wish to get an in-memory object tree from the source file Unmarshaller u = ctxt.createUnmarshaller(); OSM osm = (OSM) u.unmarshal(new java.io.File("some-file.xml")); // From here the OSM object may be used and modified however you please. // Now we wish to write the in-memory objects to a destination file Marshaller m = ctxt.createMarshaller(); m.marshal(osm, new java.io.FileWriter(new java.io.File("some-result.xml")));
OSM ObjectSet Gen/Spec RelationshipSet Aggregation Object Association Relationship State GeneralConstraint Transition Note Conjunction Lexicon DataInstance Macro OSMX Structure ObjectSet NameList Name DataFrame InternalRepresentation ValuePhraseList ValuePhrase KeywordPhraseList KeywordPhrase MethodList OSM
Sample OSMX Document <OSMxmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.deg.byu.edu/xml/osmx.xsd http://www.deg.byu.edu/xml/osmx.xsd' xmlns='http://www.deg.byu.edu/xml/osmx.xsd' order="1"> <Macrolabel="SomeMacro">[0-9]+</Macro> <Note><Textorder="2"content="Some note."></Text></Note> </OSM>
Available Projects • Data frame library management tool • Data instance validator • Convert and validate old ontologies • Automatic precision/recall calculator (store and reuse hand-tagged data) • OSM-L to OSMX converter (use existing C parser to emit XML?) • Data instance to SQL ‘insert’ converter • OSMX to OSM-L stylesheet (XSLT)
CVS Techniques • Tagging: Store a “milestone” • Branching: Parallel development • Steps • Create tag/branch on selection or entire module • Update from repository, specifying tag/branch • Tag/branch “sticks” to your local working files when you commit changes • Merge branches when done • Switch to trunk or other branch using ‘update’
Java Best Practices • Coding standard • Follow Sun’s example • See Sun’s “The Java Tutorial” for samples • Use javadoc comments • Avoid hard-coded constants • Have editor expand tabs to spaces • Indent two spaces • Use white space thoughtfully
Using Java • Stay up-to-date but avoid “bleeding edge” where possible • Java 1.2: Swing (instead of AWT) • Java 1.3: Collections (instead of Vector, Hashtable, Enumeration) • Java 1.4: javax.xml, java.nio, asserts, logging, preferences, … • Java 1.5 (coming): generic types, etc. • Check within code for support of new features so older VMs fail gracefully
Resources • java.sun.com • Tutorials • API documentation • developer.java.sun.com • TechTips e-mail newsletter • Free tools • Sun’s stuff, of course • JBuilder, Eclipse
Additional Resources • xml.apache.org (xerces, xalan) • w3.org (XML specs and resources) • xml.com (XML tutorials) • netbeans.org (good free Java IDE) • CVS repository • DEG website