pax_global_header00006660000000000000000000000064125717036750014527gustar00rootroot0000000000000052 comment=d48cb762056c1356c9575ffbeb91709f9cac0fd3 xmlcatalog-org.protege.xmlcatalog-1.0.5/000077500000000000000000000000001257170367500202505ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/.gitignore000066400000000000000000000001001257170367500222270ustar00rootroot00000000000000# # Maven # target # # Eclipse # .classpath .project .settings xmlcatalog-org.protege.xmlcatalog-1.0.5/.travis.yml000066400000000000000000000003041257170367500223560ustar00rootroot00000000000000language: java jdk: - oraclejdk7 - openjdk7 notifications: email: recipients: - vendetti@stanford.edu - tredmond@stanford.edu on_success: never on_failure: always xmlcatalog-org.protege.xmlcatalog-1.0.5/LICENSE000066400000000000000000000167201257170367500212630ustar00rootroot00000000000000GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. xmlcatalog-org.protege.xmlcatalog-1.0.5/pom.xml000066400000000000000000000142021257170367500215640ustar00rootroot00000000000000 4.0.0 org.sonatype.oss oss-parent 7 edu.stanford.protege org.protege.xmlcatalog 1.0.5 bundle XML Catalog Management Tool XML Catalog Management Tool http://protege.stanford.edu Stanford Center for Biomedical Informatics Research http://bmir.stanford.edu/ GNU Lesser General Public License http://www.gnu.org/copyleft/lesser.html Timothy Redmond tredmond@stanford.edu protege-user https://mailman.stanford.edu/mailman/listinfo/protege-user https://mailman.stanford.edu/mailman/listinfo/protege-user protege-user@lists.stanford.edu http://protege-project.136.n4.nabble.com/ https://mailman.stanford.edu/pipermail/protege-user/ scm:git:git@github.com:protegeproject/xmlcatalog.git scm:git:git@github.com:protegeproject/xmlcatalog.git git@github.com:protegeproject/xmlcatalog.git UTF-8 log4j log4j [1.2.0,1.3) org.testng testng 5.10 jdk15 test xml-resolver xml-resolver 1.2 net.sourceforge.owlapi owlapi-osgidistribution [3.5.2,3.9) org.apache.maven.plugins maven-compiler-plugin 3.2 1.6 1.6 org.apache.felix maven-bundle-plugin 2.5.3 true org.protege.xmlcatalog The Protege Development Team org.protege.xmlcatalog.* * . org.apache.maven.plugins maven-surefire-plugin 2.13 true unit-tests test test false src/test/resources/unit-tests.xml maven-pmd-plugin 3.0 1.6 prepare-release false org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar org.apache.maven.plugins maven-javadoc-plugin 2.9.1 attach-javadocs jar org.apache.maven.plugins maven-gpg-plugin 1.5 sign-artifacts verify sign xmlcatalog-org.protege.xmlcatalog-1.0.5/src/000077500000000000000000000000001257170367500210375ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/000077500000000000000000000000001257170367500217635ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/000077500000000000000000000000001257170367500227045ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/000077500000000000000000000000001257170367500234735ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/000077500000000000000000000000001257170367500251405ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/000077500000000000000000000000001257170367500272735ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/CatalogUtilities.java000066400000000000000000000072041257170367500334070ustar00rootroot00000000000000package org.protege.xmlcatalog; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.TransformerException; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.exception.CatalogParseException; import org.protege.xmlcatalog.parser.Handler; import org.protege.xmlcatalog.redirect.UriRedirectVisitor; import org.protege.xmlcatalog.write.XMLCatalogWriter; import org.xml.sax.InputSource; public class CatalogUtilities { public static XMLCatalog parseDocument(URL catalog) throws IOException { try { URI xmlbase = catalog.toURI(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); Handler handler = new Handler(xmlbase); InputSource is = new InputSource(catalog.openStream()); is.setEncoding("UTF-8"); // is this necessary? SAXParser parser = factory.newSAXParser(); parser.parse(is, handler); return handler.getCatalog(); } catch (Exception e) { throw new CatalogParseException(e); } } public static void save(XMLCatalog catalog, File f) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), "UTF-8"); XMLCatalogWriter xwriter = new XMLCatalogWriter(catalog, writer); try { xwriter.write(); writer.flush(); writer.close(); } catch (ParserConfigurationException pce) { IOException ioe = new IOException("Error writing catalog to file " + f); ioe.initCause(pce); throw ioe; } catch (TransformerException te) { IOException ioe = new IOException("Error writing catalog to file " + f); ioe.initCause(te); throw ioe; } } public static URI getRedirect(URI original, XMLCatalog catalog) { UriRedirectVisitor visitor = new UriRedirectVisitor(original); for (Entry subEntry : catalog.getEntries()) { subEntry.accept(visitor); if (visitor.getRedirect() != null) { break; } } return visitor.getRedirect() == null ? null : visitor.getRedirect(); } public static URI resolveXmlBase(XmlBaseContext context) { URI xmlbase = null; while (xmlbase == null && context != null) { xmlbase = context.getXmlBase(); context = context.getXmlBaseContext(); } if (!xmlbase.isAbsolute()) { URI outerBase = resolveXmlBase(context); xmlbase = outerBase.resolve(xmlbase); } return xmlbase; } public static URI relativize(URI u, XmlBaseContext context) { URI xmlbase = resolveXmlBase(context); if (xmlbase == null) { return u; } String path = xmlbase.getPath(); int index; if (path != null && (index = path.lastIndexOf("/")) != -1) { path = path.substring(0, index + 1); try { xmlbase = new URI(xmlbase.getScheme(), xmlbase.getUserInfo(), xmlbase.getHost(), xmlbase.getPort(), path, null, null); } catch (URISyntaxException e) { ; } } return xmlbase.relativize(u); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/EntryVisitor.java000066400000000000000000000017161257170367500326240ustar00rootroot00000000000000package org.protege.xmlcatalog; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; public interface EntryVisitor { void visit(GroupEntry entry); void visit(PublicEntry entry); void visit(SystemEntry entry); void visit(RewriteSystemEntry entry); void visit(DelegatePublicEntry entry); void visit(DelegateSystemEntry entry); void visit(UriEntry entry); void visit(RewriteUriEntry entry); void visit(DelegateUriEntry entry); void visit(NextCatalogEntry entry); } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/Prefer.java000066400000000000000000000005431257170367500313630ustar00rootroot00000000000000/** * */ package org.protege.xmlcatalog; import org.protege.xmlcatalog.parser.Handler; public enum Prefer { PUBLIC(Handler.PREFER_PUBLIC_VALUE), SYSTEM(Handler.PREFER_SYSTEM_VALUE); private String name; private Prefer(String name) { this.name = name; } public String getName() { return name; } }xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/XMLCatalog.java000066400000000000000000000032451257170367500320750ustar00rootroot00000000000000package org.protege.xmlcatalog; import java.net.URI; import java.util.ArrayList; import java.util.List; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.parser.OuterXmlBaseContext; public class XMLCatalog implements XmlBaseContext { private XmlBaseContext context; private Prefer prefer; private URI xmlBase; private List entries = new ArrayList(); public XMLCatalog(URI xmlBase) { this(null, new OuterXmlBaseContext(xmlBase), Prefer.PUBLIC, null); } public XMLCatalog(String id, XmlBaseContext context, Prefer prefer, URI xmlBase) { this.context = context; this.prefer = prefer; this.xmlBase = xmlBase; } public XmlBaseContext getXmlBaseContext() { return context; } public void setXmlBaseContext(XmlBaseContext context) { this.context = context; } public Prefer getPrefer() { return prefer; } public void setPrefer(Prefer prefer) { this.prefer = prefer; } public URI getXmlBase() { return xmlBase; } public void setXmlBase(URI xmlBase) { this.xmlBase = xmlBase; } public List getEntries() { return new ArrayList(entries); } public void addEntry(Entry e) { entries.add(e); } public void addEntry(int index, Entry e) { entries.add(index, e); } public void removeEntry(Entry e) { entries.remove(e); } public void replaceEntry(Entry original, Entry changed) { int i = entries.indexOf(original); entries.remove(original); entries.add(i, changed); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/XmlBaseContext.java000066400000000000000000000003011257170367500330300ustar00rootroot00000000000000package org.protege.xmlcatalog; import java.net.URI; public interface XmlBaseContext { void setXmlBase(URI xmlbase); URI getXmlBase(); XmlBaseContext getXmlBaseContext(); } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/000077500000000000000000000000001257170367500304345ustar00rootroot00000000000000AbstractDelegateEntry.java000066400000000000000000000030701257170367500354400ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XmlBaseContext; import org.protege.xmlcatalog.XMLCatalog; public abstract class AbstractDelegateEntry extends Entry implements XmlBaseContext { private URI catalog; private XMLCatalog delegate; private URI xmlbase; public AbstractDelegateEntry(String id, XmlBaseContext xmlBaseContext, URI catalog, URI xmlbase) { super(id, xmlBaseContext); this.catalog = catalog; this.xmlbase = xmlbase; } public URI getCatalog() { return catalog; } public void setCatalog(URI catalog) { this.catalog = catalog; } public XMLCatalog getParsedCatalog() throws IOException { if (delegate == null) { try { URI base = CatalogUtilities.resolveXmlBase(this); URI doc = base.resolve(catalog); delegate = CatalogUtilities.parseDocument(doc.toURL()); } catch (MalformedURLException mue) { IOException ioe = new IOException(mue.getMessage()); ioe.initCause(mue); throw ioe; } } return delegate; } public URI getXmlBase() { return xmlbase; } public void setXmlBase(URI xmlbase) { this.xmlbase = xmlbase; } public String toString() { return "--> Delegate Catalog(@" + delegate.getXmlBase() + ")"; } } AbstractUriEntry.java000066400000000000000000000023341257170367500344670ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XmlBaseContext; public abstract class AbstractUriEntry extends Entry implements XmlBaseContext { private URI uri; private URI xmlBase; protected AbstractUriEntry(String id, XmlBaseContext context, URI uri, URI xmlBase) { super(id, context); this.uri = uri; this.xmlBase = xmlBase; } public URI getUri() { return uri; } public void setUri(URI uri) { this.uri = uri; } public URI getXmlBase() { return xmlBase; } public void setXmlBase(URI xmlbase) { this.xmlBase = xmlbase; } public URI getAbsoluteURI() { return AbstractUriEntry.resolveUriAgainstXmlBase(getUri(), this); } public static URI resolveUriAgainstXmlBase(URI relative, XmlBaseContext context) { URI xmlbase = CatalogUtilities.resolveXmlBase(context); if (xmlbase == null) { return relative; } else { return xmlbase.resolve(relative); } } @Override public String toString() { return "--> " + getUri(); } } DelegatePublicEntry.java000066400000000000000000000016551257170367500351220ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class DelegatePublicEntry extends AbstractDelegateEntry { private String publicIdStartString; public DelegatePublicEntry(String id, XmlBaseContext xmlBaseContext, String publicIdStartString, URI catalog, URI xmlbase) { super(id, xmlBaseContext, catalog, xmlbase); this.publicIdStartString = publicIdStartString; } public String getPublicIdStartString() { return publicIdStartString; } public void setPublicIdStartString(String publicIdStartString) { this.publicIdStartString = publicIdStartString; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return "Public " + publicIdStartString + super.toString(); } } DelegateSystemEntry.java000066400000000000000000000016611257170367500351650ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class DelegateSystemEntry extends AbstractDelegateEntry { private String systemIdStartString; public DelegateSystemEntry(String id, XmlBaseContext xmlBaseContext, String systemIdStartString, URI catalog, URI xmlbase) { super(id, xmlBaseContext, catalog, xmlbase); this.systemIdStartString = systemIdStartString; } public String getSystemIdStartString() { return systemIdStartString; } public void setSystemIdStartString(String systemIdStartString) { this.systemIdStartString = systemIdStartString; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return "System " + systemIdStartString + super.toString(); } } DelegateUriEntry.java000066400000000000000000000015621257170367500344400ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class DelegateUriEntry extends AbstractDelegateEntry { private String uriStartString; public DelegateUriEntry(String id, XmlBaseContext xmlBaseContext, String uriStartString, URI catalog, URI xmlbase) { super(id, xmlBaseContext, catalog, xmlbase); this.uriStartString = uriStartString; } public String getUriStartString() { return uriStartString; } public void setUriStartString(String uriStartString) { this.uriStartString = uriStartString; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return "Uri " + uriStartString + super.toString(); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/Entry.java000066400000000000000000000012101257170367500323720ustar00rootroot00000000000000package org.protege.xmlcatalog.entry; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public abstract class Entry { private String id; private XmlBaseContext xmlBaseContext; protected Entry(String id, XmlBaseContext xmlBaseContext) { super(); this.id = id; this.xmlBaseContext = xmlBaseContext; } public String getId() { return id; } public void setId(String id) { this.id = id; } public XmlBaseContext getXmlBaseContext() { return xmlBaseContext; } public abstract void accept(EntryVisitor visitor); } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/GroupEntry.java000066400000000000000000000026731257170367500334250ustar00rootroot00000000000000package org.protege.xmlcatalog.entry; import java.net.URI; import java.util.ArrayList; import java.util.List; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.Prefer; import org.protege.xmlcatalog.XmlBaseContext; public class GroupEntry extends Entry implements XmlBaseContext { private Prefer prefer; private URI xmlBase; private List entries = new ArrayList(); public GroupEntry(String id, XmlBaseContext xmlBaseContext, Prefer prefer, URI xmlBase) { super(id, xmlBaseContext); this.prefer = prefer; this.xmlBase = xmlBase; } public Prefer getPrefer() { return prefer; } public void setPrefer(Prefer prefer) { this.prefer = prefer; } public URI getXmlBase() { return xmlBase; } public void setXmlBase(URI xmlBase) { this.xmlBase = xmlBase; } public List getEntries() { return new ArrayList(entries); } public void addEntry(Entry e) { entries.add(e); } public void addEntry(int index, Entry e) { entries.add(index, e); } public void removeEntry(Entry e) { entries.remove(e); } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return "Group Entry(" + getId() + ") with " + entries.size() + " entries"; } } NextCatalogEntry.java000066400000000000000000000007401257170367500344540ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class NextCatalogEntry extends AbstractDelegateEntry { public NextCatalogEntry(String id, XmlBaseContext xmlBaseContext, URI catalog, URI xmlbase) { super(id, xmlBaseContext, catalog, xmlbase); } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/PublicEntry.java000066400000000000000000000014531257170367500335420ustar00rootroot00000000000000package org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class PublicEntry extends AbstractUriEntry { private String publicId; public PublicEntry(String id, XmlBaseContext xmlBaseContext, String publicId, URI uri, URI xmlbase) { super(id, xmlBaseContext, uri, xmlbase); this.publicId = publicId; } public String getPublicId() { return publicId; } public void setPublicId(String publicId) { this.publicId = publicId; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return "Public id " + getPublicId() + super.toString(); } } RewriteSystemEntry.java000066400000000000000000000020131257170367500350640ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class RewriteSystemEntry extends Entry { private String systemIdStartString; private URI rewritePrefix; public RewriteSystemEntry(String id, XmlBaseContext xmlBaseContext, String systemIdStartString, URI rewritePrefix) { super(id, xmlBaseContext); this.systemIdStartString = systemIdStartString; this.rewritePrefix = rewritePrefix; } public String getSystemIdStartString() { return systemIdStartString; } public void setSystemIdStartString(String systemIdStartString) { this.systemIdStartString = systemIdStartString; } public URI getRewritePrefix() { return rewritePrefix; } public void setRewritePrefix(URI rewritePrefix) { this.rewritePrefix = rewritePrefix; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } } RewriteUriEntry.java000066400000000000000000000017241257170367500343470ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entrypackage org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class RewriteUriEntry extends Entry { private String uriStartString; private URI rewritePrefix; public RewriteUriEntry(String id, XmlBaseContext xmlBaseContext, String uriStartString, URI rewritePrefix) { super(id, xmlBaseContext); this.uriStartString = uriStartString; this.rewritePrefix = rewritePrefix; } public String getUriStartString() { return uriStartString; } public void setUriStartString(String uriStartString) { this.uriStartString = uriStartString; } public URI getRewritePrefix() { return rewritePrefix; } public void setRewritePrefix(URI rewritePrefix) { this.rewritePrefix = rewritePrefix; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/SystemEntry.java000066400000000000000000000012571257170367500336120ustar00rootroot00000000000000package org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class SystemEntry extends AbstractUriEntry { private String systemId; public SystemEntry(String id, XmlBaseContext xmlBaseContext, String systemId, URI uri, URI xmlbase) { super(id, xmlBaseContext, uri, xmlbase); this.systemId = systemId; } public String getSystemId() { return systemId; } public void setSystemId(String systemId) { this.systemId = systemId; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/entry/UriEntry.java000066400000000000000000000013321257170367500330570ustar00rootroot00000000000000package org.protege.xmlcatalog.entry; import java.net.URI; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; public class UriEntry extends AbstractUriEntry { private String name; public UriEntry(String id, XmlBaseContext xmlBaseContext, String name, URI uri, URI xmlbase) { super(id, xmlBaseContext, uri, xmlbase); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public void accept(EntryVisitor visitor) { visitor.visit(this); } @Override public String toString() { return name + super.toString(); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/exception/000077500000000000000000000000001257170367500312715ustar00rootroot00000000000000CatalogParseException.java000066400000000000000000000007551257170367500363100ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/exceptionpackage org.protege.xmlcatalog.exception; import java.io.IOException; public class CatalogParseException extends IOException { private static final long serialVersionUID = -2087487036403016848L; public CatalogParseException() { } public CatalogParseException(String msg) { super(msg); } public CatalogParseException(Throwable t) { super(t.getMessage()); initCause(t); } public CatalogParseException(String msg, Throwable t) { super(msg); initCause(t); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/owlapi/000077500000000000000000000000001257170367500305665ustar00rootroot00000000000000XMLCatalogIRIMapper.java000066400000000000000000000015561257170367500350250ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/owlapipackage org.protege.xmlcatalog.owlapi; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XMLCatalog; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLOntologyIRIMapper; public class XMLCatalogIRIMapper implements OWLOntologyIRIMapper { private XMLCatalog catalog; public XMLCatalogIRIMapper(File f) throws MalformedURLException, IOException { this(CatalogUtilities.parseDocument(f.toURI().toURL())); } public XMLCatalogIRIMapper(XMLCatalog catalog) { this.catalog = catalog; } @Override public IRI getDocumentIRI(IRI original) { URI redirect = CatalogUtilities.getRedirect(original.toURI(), catalog); if (redirect != null) { return IRI.create(redirect); } else return null; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/parser/000077500000000000000000000000001257170367500305675ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/parser/Handler.java000066400000000000000000000236501257170367500330150ustar00rootroot00000000000000package org.protege.xmlcatalog.parser; import java.net.URI; import java.util.Stack; import org.apache.log4j.Logger; import org.protege.xmlcatalog.Prefer; import org.protege.xmlcatalog.XMLCatalog; import org.protege.xmlcatalog.XmlBaseContext; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class Handler extends DefaultHandler { private static final Logger logger = Logger.getLogger(Handler.class); public final static String CATALOG_NAMESPACE = "urn:oasis:names:tc:entity:xmlns:xml:catalog"; /* *********************** Elements *********************** */ public final static String CATALOG_ELEMENT = "catalog"; public final static String GROUP_ELEMENT = "group"; public final static String PUBLIC_ELEMENT = "public"; public final static String SYSTEM_ELEMENT = "system"; public final static String REWRITE_SYSTEM_ELEMENT = "rewriteSystem"; public final static String DELEGATE_PUBLIC_ELEMENT = "delegatePublic"; public final static String DELEGATE_SYSTEM_ELEMENT = "delegateSystem"; public final static String URI_ELEMENT = "uri"; public final static String REWRITE_URI_ELEMENT = "rewriteURI"; public final static String DELEGATE_URI_ELEMENT = "delegateURI"; public final static String NEXT_CATALOG_ELEMENT = "nextCatalog"; /* *********************** Attributes *********************** */ public final static String ID_ATTRIBUTE = "id"; public final static String PREFER_ATTRIBUTE = "prefer"; public final static String XML_BASE_ATTRIBUTE = "xml:base"; /* public element */ public final static String PUBLIC_ID_ATTRIBUTE = "publicId"; public final static String URI_ATTRIBUTE = "uri"; /* system element */ public final static String SYSTEM_ID_ATTRIBUTE = "systemId"; /* rewriteSystem element */ public final static String SYSTEM_ID_START_ATTRIBUTE = "systemIdStartString"; public final static String REWRITE_PREFIX_ATTRIBUTE = "rewritePrefix"; /* delegatePublic element */ public final static String PUBLIC_ID_START_ATTRIBUTE = "publicIdStartString"; /* uri element */ public final static String URI_NAME_ATTRIBUTE = "name"; /* rewriteURI element */ public final static String URI_START_STRING = "uriStartString"; /* nextCatalog element */ public final static String CATALOG_ATTRIBUTE = "catalog"; /* *********************** Values *********************** */ /* public element */ public final static String PREFER_PUBLIC_VALUE = "public"; public final static String PREFER_SYSTEM_VALUE = "system"; private XMLCatalog catalog; private XmlBaseContext outerContext; private Stack groupStack = new Stack(); public Handler() { } public Handler(URI xmlbase) { this(new OuterXmlBaseContext(xmlbase)); } public Handler(XmlBaseContext context) { outerContext = context; } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (!CATALOG_NAMESPACE.equals(uri)) { logger.warn("Found entry outside the XML Catalogs namespace - ignored"); } else if (localName.equals(CATALOG_ELEMENT)) { catalog = new XMLCatalog(getId(attributes), outerContext, getPrefer(attributes), getXmlBase(attributes)); } else if (localName.equals(GROUP_ELEMENT)) { GroupEntry group = new GroupEntry(getId(attributes), getXmlBaseContext(), getPrefer(attributes), getXmlBase(attributes)); addEntry(group); groupStack.push(group); } else if (localName.equals(PUBLIC_ELEMENT)) { addEntry(new PublicEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(PUBLIC_ID_ATTRIBUTE), URI.create(attributes.getValue(URI_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(SYSTEM_ELEMENT)) { addEntry(new SystemEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(SYSTEM_ID_ATTRIBUTE), URI.create(attributes.getValue(URI_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(REWRITE_SYSTEM_ELEMENT)) { addEntry(new RewriteSystemEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(SYSTEM_ID_START_ATTRIBUTE), URI.create(attributes.getValue(REWRITE_PREFIX_ATTRIBUTE)))); } else if (localName.equals(DELEGATE_PUBLIC_ELEMENT)) { addEntry(new DelegatePublicEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(PUBLIC_ID_START_ATTRIBUTE), URI.create(attributes.getValue(CATALOG_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(DELEGATE_SYSTEM_ELEMENT)) { addEntry(new DelegateSystemEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(SYSTEM_ID_START_ATTRIBUTE), URI.create(attributes.getValue(CATALOG_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(URI_ELEMENT)) { addEntry(new UriEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(URI_NAME_ATTRIBUTE), URI.create(attributes.getValue(URI_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(REWRITE_URI_ELEMENT)) { addEntry(new RewriteUriEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(URI_START_STRING), URI.create(attributes.getValue(REWRITE_PREFIX_ATTRIBUTE)))); } else if (localName.equals(DELEGATE_URI_ELEMENT)) { addEntry(new DelegateUriEntry(getId(attributes), getXmlBaseContext(), attributes.getValue(URI_START_STRING), URI.create(attributes.getValue(CATALOG_ATTRIBUTE)), getXmlBase(attributes))); } else if (localName.equals(NEXT_CATALOG_ELEMENT)) { addEntry(new NextCatalogEntry(getId(attributes), getXmlBaseContext(), URI.create(attributes.getValue(CATALOG_ATTRIBUTE)), getXmlBase(attributes))); } else { logger.error("Found unsupported element in xmlcatalog: " + localName); } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if (uri.equals(CATALOG_NAMESPACE) && localName.equals(GROUP_ELEMENT)) { groupStack.pop(); } } public XMLCatalog getCatalog() { return catalog; } private void addEntry(Entry entry) { if (groupStack.isEmpty()) { catalog.addEntry(entry); } else { groupStack.peek().addEntry(entry); } } private String getId(Attributes attributes) { return attributes.getValue(ID_ATTRIBUTE); } private Prefer getPrefer() { if (groupStack.isEmpty()) { return catalog.getPrefer(); } else { return groupStack.peek().getPrefer(); } } private Prefer getPrefer(Attributes attributes) { String preferString = attributes.getValue(PREFER_ATTRIBUTE); if (preferString == null && catalog == null) { return null; } else if (preferString == null) { return getPrefer(); } else if (preferString.toLowerCase().equals(PREFER_PUBLIC_VALUE)) { return Prefer.PUBLIC; } else if (preferString.toLowerCase().equals(PREFER_SYSTEM_VALUE)) { return Prefer.SYSTEM; } else { return null; } } private URI getXmlBase(Attributes attributes) { String baseString = attributes.getValue(XML_BASE_ATTRIBUTE); if (baseString != null) { return URI.create(baseString); } else { return null; } } private XmlBaseContext getXmlBaseContext() { if (groupStack.isEmpty()) { return catalog; } else { return groupStack.peek(); } } } OuterXmlBaseContext.java000066400000000000000000000007711257170367500352770ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/parserpackage org.protege.xmlcatalog.parser; import java.net.URI; import org.protege.xmlcatalog.XmlBaseContext; public class OuterXmlBaseContext implements XmlBaseContext { private URI xmlbase; public OuterXmlBaseContext(URI xmlbase) { this.xmlbase = xmlbase; } public URI getXmlBase() { return xmlbase; } public XmlBaseContext getXmlBaseContext() { return null; } public void setXmlBase(URI xmlbase) { this.xmlbase = xmlbase; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/redirect/000077500000000000000000000000001257170367500310745ustar00rootroot00000000000000UriRedirectVisitor.java000066400000000000000000000063531257170367500354700ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/redirectpackage org.protege.xmlcatalog.redirect; import java.io.IOException; import java.net.URI; import org.apache.log4j.Logger; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XMLCatalog; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; public class UriRedirectVisitor implements EntryVisitor { private static Logger log = Logger.getLogger(UriRedirectVisitor.class); private URI original; private URI redirect; public UriRedirectVisitor(URI original) { this.original = original; } public URI getRedirect() { return redirect; } public void visit(GroupEntry entry) { for (Entry subEntry : entry.getEntries()) { subEntry.accept(this); if (redirect != null) { break; } } } public void visit(PublicEntry entry) { ; } public void visit(SystemEntry entry) { ; } public void visit(RewriteSystemEntry entry) { ; } public void visit(DelegatePublicEntry entry) { ; } public void visit(DelegateSystemEntry entry) { ; } public void visit(UriEntry entry) { if (original.equals(URI.create(entry.getName()))) { redirect = entry.getAbsoluteURI(); } } public void visit(RewriteUriEntry entry) { try { String originalString = original.toString(); if (originalString.startsWith(entry.getUriStartString())) { String suffix = originalString.substring(entry.getUriStartString().length()); redirect = URI.create(entry.getRewritePrefix().toString() + suffix); } } catch (Throwable e) { log.error("Exception caught trying to resolve " + original, e); } } public void visit(DelegateUriEntry entry) { try { if (original.isAbsolute()) { String originalString = original.toString(); if (originalString.startsWith(entry.getUriStartString())) { visitCatalog(entry.getParsedCatalog()); } } } catch (IOException ioe) { log.error("Exception caught trying to resolve " + original, ioe); } } public void visit(NextCatalogEntry entry) { try { visitCatalog(entry.getParsedCatalog()); } catch (IOException ioe) { log.error("Exception caught trying to resolve " + original, ioe); } } private void visitCatalog(XMLCatalog catalog) { for (Entry subEntry : catalog.getEntries()) { subEntry.accept(this); if (redirect != null) { break; } } } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swing/000077500000000000000000000000001257170367500304225ustar00rootroot00000000000000AltCellRenderer.java000066400000000000000000000053121257170367500342160ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swingpackage org.protege.xmlcatalog.swing; import java.awt.Component; import javax.swing.JLabel; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; public class AltCellRenderer extends DefaultTreeCellRenderer { private static final long serialVersionUID = 5872637762761958584L; private EntryRenderingVisitor visitor = new EntryRenderingVisitor(); public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (value instanceof CatalogTreeNode) { label.setText("" + ((CatalogTreeNode) value).getCatalog().getXmlBase()); } else { EntryTreeNode node = (EntryTreeNode) value; if (node.getEditor() != null) { label.setText(node.getEditor().getDescription(node.getEntry())); } else { node.getEntry().accept(visitor); label.setText(visitor.getText()); } } if (selected) { label.setBackground(backgroundSelectionColor); } else { label.setBackground(backgroundNonSelectionColor); } return label; } private class EntryRenderingVisitor implements EntryVisitor { private String text; public String getText() { return text; } public void visit(GroupEntry entry) { text = "Group Entry"; } public void visit(PublicEntry entry) { text = "Not implemented yet"; } public void visit(SystemEntry entry) { text = "Not implemented yet"; } public void visit(RewriteSystemEntry entry) { text = "Not implemented yet"; } public void visit(DelegatePublicEntry entry) { text = "Not implemented yet"; } public void visit(DelegateSystemEntry entry) { text = "Not implemented yet"; } public void visit(UriEntry entry) { text = entry.getName() + " \u2192 " + entry.getUri(); } public void visit(RewriteUriEntry entry) { text = "Not implemented yet"; } public void visit(DelegateUriEntry entry) { text = "Not implemented yet"; } public void visit(NextCatalogEntry entry) { text = "Not implemented yet"; } } } CatalogEditor.java000066400000000000000000000024401257170367500337270ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swingpackage org.protege.xmlcatalog.swing; import java.awt.BorderLayout; import java.awt.Dimension; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XMLCatalog; public class CatalogEditor extends JPanel { private static final long serialVersionUID = 4105691012851258776L; public CatalogEditor(XMLCatalog catalog, List editors) { setLayout(new BorderLayout()); add(new CatalogJTree(catalog, editors), BorderLayout.CENTER); } public static void main(String[] args) { try { JFrame frame = new JFrame("Catalog Viewer"); frame.setLayout(new BorderLayout()); frame.setPreferredSize(new Dimension(1024, 768)); JFileChooser jfc = new JFileChooser(); int ret = jfc.showOpenDialog(frame); if (ret == JFileChooser.APPROVE_OPTION) { File f = jfc.getSelectedFile(); XMLCatalog catalog = CatalogUtilities.parseDocument(f.toURI().toURL()); frame.add(new CatalogEditor(catalog, new ArrayList())); frame.setVisible(true); frame.repaint(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } catch (Throwable t) { t.printStackTrace(); } } } CatalogEditorTransferHandler.java000066400000000000000000000050201257170367500367270ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swingpackage org.protege.xmlcatalog.swing; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import javax.swing.JComponent; import javax.swing.TransferHandler; import org.apache.log4j.Logger; public class CatalogEditorTransferHandler extends TransferHandler { private static final long serialVersionUID = 1160492460896419035L; public static final Logger LOGGER = Logger.getLogger(CatalogEditorTransferHandler.class); public int getSourceActions(JComponent c) { EntryTreeNode e = getEntryTreeNode(c); if (e == null) { return NONE; } else if (e.isAutoGenerated()) { return COPY; } else { return MOVE; } } protected Transferable createTransferable(JComponent c) { final EntryTreeNode e = getEntryTreeNode(c); if (e == null) { return null; } return new Transferable() { public boolean isDataFlavorSupported(DataFlavor flavor) { return flavor.getRepresentationClass().equals(EntryTreeNode.class); } public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[] { new DataFlavor(EntryTreeNode.class, "XML Catalog Entry")}; } public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { return e; } }; } public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { if (LOGGER.isDebugEnabled() && comp instanceof CatalogJTree) { LOGGER.debug("Last selected component " + ((CatalogJTree) comp).getLastSelectedPathComponent()); } EntryTreeNode e = getEntryTreeNode(comp); if (e != null && (e.isAutoGenerated() || e.getEditor() != null)) { return false; } else if (e == null && getCatalogTreeNode(comp) == null) { return false; } for (DataFlavor flavor : transferFlavors) { if (EntryTreeNode.class.equals(flavor.getRepresentationClass())) { return true; } } return false; } private EntryTreeNode getEntryTreeNode(JComponent c) { if (!(c instanceof CatalogJTree)) { return null; } CatalogJTree tree = (CatalogJTree) c; Object o = tree.getLastSelectedPathComponent(); if (!(o instanceof EntryTreeNode)) { return null; } return (EntryTreeNode) o; } private CatalogTreeNode getCatalogTreeNode(JComponent c) { if (!(c instanceof CatalogJTree)) { return null; } CatalogJTree tree = (CatalogJTree) c; Object o = tree.getLastSelectedPathComponent(); if (!(o instanceof CatalogTreeNode)) { return null; } return (CatalogTreeNode) o; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swing/CatalogJTree.java000066400000000000000000000007671257170367500336030ustar00rootroot00000000000000package org.protege.xmlcatalog.swing; import java.util.List; import javax.swing.JTree; import org.protege.xmlcatalog.XMLCatalog; public class CatalogJTree extends JTree { private static final long serialVersionUID = -8502646155443727063L; public CatalogJTree(XMLCatalog catalog, List editors) { super(new CatalogTreeNode(catalog, editors), true); setCellRenderer(new AltCellRenderer()); setDragEnabled(true); setTransferHandler(new CatalogEditorTransferHandler()); } } CatalogTreeNode.java000066400000000000000000000040031257170367500342030ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swingpackage org.protege.xmlcatalog.swing; import java.util.Enumeration; import java.util.List; import java.util.NoSuchElementException; import javax.swing.tree.TreeNode; import org.protege.xmlcatalog.XMLCatalog; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.entry.NextCatalogEntry; public class CatalogTreeNode implements TreeNode { private TreeNode parent; private XMLCatalog catalog; private List editors; public CatalogTreeNode(XMLCatalog catalog, List editors) { this(null, catalog, editors); } public CatalogTreeNode(TreeNode parent, XMLCatalog catalog, List editors) { this.parent = parent; this.catalog = catalog; this.editors = editors; } public XMLCatalog getCatalog() { return catalog; } public List getEditors() { return editors; } /* ************************************************ * TreeNode interfaces. */ public TreeNode getChildAt(int childIndex) { Entry e = catalog.getEntries().get(childIndex); return new EntryTreeNode(this, e, editors); } public int getChildCount() { return catalog.getEntries().size(); } public TreeNode getParent() { return parent; } public int getIndex(TreeNode node) { if (parent instanceof EntryTreeNode && ((EntryTreeNode) parent).getEditor() instanceof NextCatalogEntry && parent.getChildAt(0) == catalog) { return 0; } return -1; } public boolean getAllowsChildren() { return true; } public boolean isLeaf() { return catalog.getEntries().size() == 0; } public Enumeration children() { return new Enumeration() { int currentIndex = 0; public boolean hasMoreElements() { return currentIndex < getChildCount(); } public TreeNode nextElement() throws NoSuchElementException { if (!hasMoreElements()) { throw new NoSuchElementException("No such element"); } try { return getChildAt(currentIndex); } finally { currentIndex++; } } }; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swing/CellRenderer.java000066400000000000000000000065651257170367500336470ustar00rootroot00000000000000package org.protege.xmlcatalog.swing; import java.awt.Color; import java.awt.Component; import javax.swing.JLabel; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.tree.TreeCellRenderer; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; public class CellRenderer implements TreeCellRenderer { private JLabel label = new JLabel(); private EntryRenderingVisitor visitor = new EntryRenderingVisitor(); private boolean colorsInitialized = false; // Colors /** Color to use for the foreground for selected nodes. */ protected Color textSelectionColor; /** Color to use for the foreground for non-selected nodes. */ protected Color textNonSelectionColor; /** Color to use for the background when a node is selected. */ protected Color backgroundSelectionColor; /** Color to use for the background when the node isn't selected. */ protected Color backgroundNonSelectionColor; public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { initColors(tree); if (value instanceof CatalogTreeNode) { label.setText("" + ((CatalogTreeNode) value).getCatalog().getXmlBase()); } else { EntryTreeNode node = (EntryTreeNode) value; if (node.getEditor() != null) { label.setText(node.getEditor().getDescription(node.getEntry())); } else { node.getEntry().accept(visitor); } } if (selected) { label.setBackground(backgroundSelectionColor); } else { label.setBackground(backgroundNonSelectionColor); } return label; } private void initColors(JTree tree) { if (!colorsInitialized) { backgroundSelectionColor = UIManager.getColor("Tree.selectionBackground"); backgroundNonSelectionColor = UIManager.getColor("Tree.textBackground"); colorsInitialized = true; } } private class EntryRenderingVisitor implements EntryVisitor { public void visit(GroupEntry entry) { label.setText("Group Entry"); } public void visit(PublicEntry entry) { label.setText("Not implemented yet"); } public void visit(SystemEntry entry) { label.setText("Not implemented yet"); } public void visit(RewriteSystemEntry entry) { label.setText("Not implemented yet"); } public void visit(DelegatePublicEntry entry) { label.setText("Not implemented yet"); } public void visit(DelegateSystemEntry entry) { label.setText("Not implemented yet"); } public void visit(UriEntry entry) { label.setText(entry.getName() + " \u2192 " + entry.getUri()); } public void visit(RewriteUriEntry entry) { label.setText("Not implemented yet"); } public void visit(DelegateUriEntry entry) { label.setText("Not implemented yet"); } public void visit(NextCatalogEntry entry) { label.setText("Not implemented yet"); } } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swing/EntryEditor.java000066400000000000000000000006171257170367500335410ustar00rootroot00000000000000package org.protege.xmlcatalog.swing; import java.awt.Frame; import org.protege.xmlcatalog.XmlBaseContext; import org.protege.xmlcatalog.entry.Entry; public interface EntryEditor { boolean isSuitable(Entry ge); Entry newEntryDialog(Frame parent, XmlBaseContext context); Entry editEntryDialog(Frame parent, XmlBaseContext context, Entry input); String getDescription(Entry ge); } EntryTreeNode.java000066400000000000000000000072601257170367500337420ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/swingpackage org.protege.xmlcatalog.swing; import java.util.Enumeration; import java.util.List; import java.util.NoSuchElementException; import javax.swing.tree.TreeNode; import org.apache.log4j.Logger; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XMLCatalog; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; public class EntryTreeNode implements TreeNode { public static final Logger LOGGER = Logger.getLogger(EntryTreeNode.class); private TreeNode parent; private Entry entry; private List editors; private EntryEditor editor; private boolean autoGenerated; private XMLCatalog childCatalog; // only if the entry is a NextCatalogEntry. public EntryTreeNode(TreeNode parent, Entry entry, List editors) { if (!(parent instanceof CatalogTreeNode) && !(parent instanceof EntryTreeNode)) { throw new IllegalArgumentException("Invalid Parent!"); } this.entry = entry; this.editors = editors; this.parent = parent; editor = null; autoGenerated = false; boolean isParentAutoGenerated; if (parent instanceof CatalogTreeNode) { isParentAutoGenerated = false; } else { isParentAutoGenerated = ((EntryTreeNode) parent).isAutoGenerated(); } if (isParentAutoGenerated) { autoGenerated = true; } else { for (EntryEditor editor : editors) { if (editor.isSuitable(entry)) { this.editor = editor; } } } } public Entry getEntry() { return entry; } public List getEditors() { return editors; } public EntryEditor getEditor() { return editor; } public boolean isAutoGenerated() { return autoGenerated; } /* ********************************************* * TreeNode Interfaces */ public TreeNode getChildAt(int childIndex) { if (entry instanceof GroupEntry) { Entry childEntry = ((GroupEntry) entry).getEntries().get(childIndex); return new EntryTreeNode(this, childEntry, editors); } else if (entry instanceof NextCatalogEntry && childIndex == 0) { try { if (childCatalog == null) { childCatalog = CatalogUtilities.parseDocument(((NextCatalogEntry) entry).getCatalog().toURL()); } } catch (Exception e) { LOGGER.error("Exception caught trying to parse nested catalog in xml catalog", e); } return new CatalogTreeNode(childCatalog, editors); } return null; } public int getChildCount() { if (entry instanceof GroupEntry) { return ((GroupEntry) entry).getEntries().size(); } else if (entry instanceof NextCatalogEntry) { return 1; } else { return 0; } } public TreeNode getParent() { return parent; } public int getIndex(TreeNode node) { if (node instanceof EntryTreeNode && ((EntryTreeNode) node).getEntry() instanceof GroupEntry) { return ((GroupEntry) ((EntryTreeNode) node).getEntry()).getEntries().indexOf(entry); } return -1; } public boolean getAllowsChildren() { return entry instanceof GroupEntry || entry instanceof NextCatalogEntry; } public boolean isLeaf() { if (entry instanceof GroupEntry) { return ((GroupEntry) entry).getEntries().size() == 0; } return entry instanceof NextCatalogEntry; } public Enumeration children() { return new Enumeration() { int currentIndex = 0; public boolean hasMoreElements() { return currentIndex < getChildCount(); } public TreeNode nextElement() throws NoSuchElementException { if (!hasMoreElements()) { throw new NoSuchElementException("No such element"); } try { return getChildAt(currentIndex); } finally { currentIndex++; } } }; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/write/000077500000000000000000000000001257170367500304255ustar00rootroot00000000000000XMLCatalogWriter.java000066400000000000000000000056011257170367500343430ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/writepackage org.protege.xmlcatalog.write; import java.io.IOException; import java.io.Writer; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XMLCatalog; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.parser.Handler; import org.w3c.dom.Document; import org.w3c.dom.Element; public class XMLCatalogWriter { public static String XML_CATALOG_NS="urn:oasis:names:tc:entity:xmlns:xml:catalog"; private XMLCatalog catalog; private Writer out; public XMLCatalogWriter(XMLCatalog catalog, Writer out) { this.catalog = catalog; this.out = out; } public void write() throws IOException, ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document document = builder.newDocument(); Element root = document.createElementNS(XML_CATALOG_NS, Handler.CATALOG_ELEMENT); if (catalog.getXmlBase() != null) { root.setAttribute(Handler.XML_BASE_ATTRIBUTE, catalog.getXmlBase().toString()); } if (catalog.getPrefer() != null) { root.setAttribute(Handler.PREFER_ATTRIBUTE, catalog.getPrefer().getName()); } document.appendChild(root); XMLRenderingVisitor renderer = new XMLRenderingVisitor(document, root, CatalogUtilities.resolveXmlBase(catalog)); for (Entry entry : catalog.getEntries()) { entry.accept(renderer); } save(document); } private void save(Document document) throws TransformerFactoryConfigurationError, TransformerException { Source source = new DOMSource(document); Result result = new StreamResult(out); TransformerFactory factory = TransformerFactory.newInstance(); /* Hopefully this guards against residual effects from GForge ticket 2734 */ try { factory.setAttribute("indent-number", 4); } catch (IllegalArgumentException e) { // ok - be that way. } Transformer xformer = factory.newTransformer(); xformer.setOutputProperty(OutputKeys.METHOD, "xml"); xformer.setOutputProperty(OutputKeys.INDENT, "yes"); xformer.transform(source, result); } } XMLRenderingVisitor.java000066400000000000000000000151501257170367500350710ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/main/java/org/protege/xmlcatalog/writepackage org.protege.xmlcatalog.write; import java.net.URI; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.EntryVisitor; import org.protege.xmlcatalog.XmlBaseContext; import org.protege.xmlcatalog.entry.AbstractDelegateEntry; import org.protege.xmlcatalog.entry.DelegatePublicEntry; import org.protege.xmlcatalog.entry.DelegateSystemEntry; import org.protege.xmlcatalog.entry.DelegateUriEntry; import org.protege.xmlcatalog.entry.Entry; import org.protege.xmlcatalog.entry.GroupEntry; import org.protege.xmlcatalog.entry.NextCatalogEntry; import org.protege.xmlcatalog.entry.PublicEntry; import org.protege.xmlcatalog.entry.RewriteSystemEntry; import org.protege.xmlcatalog.entry.RewriteUriEntry; import org.protege.xmlcatalog.entry.SystemEntry; import org.protege.xmlcatalog.entry.UriEntry; import org.protege.xmlcatalog.parser.Handler; import org.w3c.dom.Document; import org.w3c.dom.Element; public class XMLRenderingVisitor implements EntryVisitor { private Document document; private Element parent; public XMLRenderingVisitor(Document document, Element parent, URI xmlbase) { this.document = document; this.parent = parent; } public void visit(GroupEntry entry) { Element groupElement = document.createElement(Handler.GROUP_ELEMENT); addId(groupElement, entry); addXmlBase(groupElement, entry); if (entry.getPrefer() != null) { groupElement.setAttribute(Handler.PREFER_ATTRIBUTE, entry.getPrefer().getName()); } parent.appendChild(groupElement); XMLRenderingVisitor subEntryVisitor = new XMLRenderingVisitor(document, groupElement, CatalogUtilities.resolveXmlBase(entry)); for (Entry subEntry : entry.getEntries()) { subEntry.accept(subEntryVisitor); } } public void visit(PublicEntry entry) { Element publicElement = document.createElement(Handler.PUBLIC_ELEMENT); addId(publicElement, entry); addXmlBase(publicElement, entry); publicElement.setAttribute(Handler.PUBLIC_ID_ATTRIBUTE, entry.getPublicId()); publicElement.setAttribute(Handler.URI_ATTRIBUTE, entry.getUri().toString()); parent.appendChild(publicElement); } public void visit(SystemEntry entry) { Element systemElement = document.createElement(Handler.SYSTEM_ELEMENT); addId(systemElement, entry); addXmlBase(systemElement, entry); systemElement.setAttribute(Handler.SYSTEM_ID_ATTRIBUTE, entry.getSystemId()); systemElement.setAttribute(Handler.URI_ATTRIBUTE, entry.getUri().toString()); parent.appendChild(systemElement); } public void visit(RewriteSystemEntry entry) { Element rewriteSystemElement = document.createElement(Handler.REWRITE_SYSTEM_ELEMENT); addId(rewriteSystemElement, entry); rewriteSystemElement.setAttribute(Handler.SYSTEM_ID_START_ATTRIBUTE, entry.getSystemIdStartString()); rewriteSystemElement.setAttribute(Handler.REWRITE_PREFIX_ATTRIBUTE, entry.getRewritePrefix().toString()); parent.appendChild(rewriteSystemElement); } public void visit(DelegatePublicEntry entry) { Element delgatePublicElement = document.createElement(Handler.DELEGATE_PUBLIC_ELEMENT); addId(delgatePublicElement, entry); addDelegate(delgatePublicElement, entry); delgatePublicElement.setAttribute(Handler.PUBLIC_ID_START_ATTRIBUTE, entry.getPublicIdStartString()); parent.appendChild(delgatePublicElement); } public void visit(DelegateSystemEntry entry) { Element delegateSystemElement = document.createElement(Handler.DELEGATE_SYSTEM_ELEMENT); addId(delegateSystemElement, entry); addDelegate(delegateSystemElement, entry); delegateSystemElement.setAttribute(Handler.SYSTEM_ID_START_ATTRIBUTE, entry.getSystemIdStartString()); parent.appendChild(delegateSystemElement); } public void visit(UriEntry entry) { Element uriElement = document.createElement(Handler.URI_ELEMENT); addId(uriElement, entry); addXmlBase(uriElement, entry); uriElement.setAttribute(Handler.URI_NAME_ATTRIBUTE, entry.getName()); uriElement.setAttribute(Handler.URI_ELEMENT, entry.getUri().toString()); parent.appendChild(uriElement); } public void visit(RewriteUriEntry entry) { Element rewriteElement = document.createElement(Handler.REWRITE_URI_ELEMENT); addId(rewriteElement, entry); rewriteElement.setAttribute(Handler.URI_START_STRING, entry.getUriStartString()); rewriteElement.setAttribute(Handler.REWRITE_PREFIX_ATTRIBUTE, entry.getRewritePrefix().toString()); parent.appendChild(rewriteElement); } public void visit(DelegateUriEntry entry) { Element delegateUriElement = document.createElement(Handler.DELEGATE_URI_ELEMENT); addId(delegateUriElement, entry); addXmlBase(delegateUriElement, entry); delegateUriElement.setAttribute(Handler.URI_START_STRING, entry.getUriStartString()); delegateUriElement.setAttribute(Handler.CATALOG_ATTRIBUTE, entry.getCatalog().toString()); parent.appendChild(delegateUriElement); } public void visit(NextCatalogEntry entry) { Element nextCatalogElement = document.createElement(Handler.NEXT_CATALOG_ELEMENT); addId(nextCatalogElement, entry); addXmlBase(nextCatalogElement, entry); nextCatalogElement.setAttribute(Handler.CATALOG_ATTRIBUTE, entry.getCatalog().toString()); parent.appendChild(nextCatalogElement); } private void addId(Element entryElement, Entry entry) { if (entry.getId() != null) { entryElement.setAttribute(Handler.ID_ATTRIBUTE, entry.getId()); } } private void addXmlBase(Element element, XmlBaseContext entry) { URI xmlbase = entry.getXmlBase(); if (xmlbase != null) { URI parentBase; if ((entry.getXmlBaseContext() != null) && ((parentBase = CatalogUtilities.resolveXmlBase(entry.getXmlBaseContext())) != null)) { xmlbase = parentBase.relativize(xmlbase); } element.setAttribute(Handler.XML_BASE_ATTRIBUTE, xmlbase.toString()); } } private void addDelegate(Element entryElement, AbstractDelegateEntry delegateEntry) { addXmlBase(entryElement, delegateEntry); entryElement.setAttribute(Handler.CATALOG_ATTRIBUTE, delegateEntry.getCatalog().toString()); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/000077500000000000000000000000001257170367500220165ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/000077500000000000000000000000001257170367500227375ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/000077500000000000000000000000001257170367500235265ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/000077500000000000000000000000001257170367500251735ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/000077500000000000000000000000001257170367500273265ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/CatalogTest.java000066400000000000000000000020431257170367500324020ustar00rootroot00000000000000package org.protege.xmlcatalog; import java.io.File; import junit.framework.TestCase; import org.apache.log4j.Logger; public class CatalogTest extends TestCase { private static final Logger log = Logger.getLogger(CatalogTest.class); public void testExample1() { try { CatalogUtilities.parseDocument(new File("src/test/resources/Example1.xml").toURI().toURL()); } catch (Throwable t) { log.warn("Test failed", t); fail(); } } public void testExample2() { try { CatalogUtilities.parseDocument(new File("src/test/resources/Example2.xml").toURI().toURL()); } catch (Throwable t) { log.warn("Test failed", t); fail(); } } public void testCatalog8() { try { CatalogUtilities.parseDocument(new File("src/test/resources/catalog08.xml").toURI().toURL()); } catch (Throwable t) { log.warn("Test failed", t); fail(); } } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/JunitUtilities.java000066400000000000000000000002631257170367500331570ustar00rootroot00000000000000package org.protege.xmlcatalog; public class JunitUtilities { public static boolean isJava5() { return System.getProperty("java.version").startsWith("1.5"); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/ResolveTest.java000066400000000000000000000136471257170367500324630ustar00rootroot00000000000000package org.protege.xmlcatalog; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import javax.xml.transform.TransformerException; import junit.framework.TestCase; import org.apache.xml.resolver.CatalogManager; import org.apache.xml.resolver.tools.CatalogResolver; public class ResolveTest extends TestCase { private CatalogResolver resolver; private XMLCatalog catalog; public void test01() throws TransformerException, MalformedURLException, IOException { readCatalog("src/test/resources/catalog01.xml"); URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = URI.create("file:/home/tredmond/Shared/ontologies/simple/ontology1.owl"); checkBothAlgorithmsSame(u, false); assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } public void test02() throws MalformedURLException, IOException, TransformerException { readCatalog("src/test/resources/catalog02.xml"); URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = URI.create("file:/home/tredmond/Shared/simple/ontology1.owl"); checkBothAlgorithmsSame(u, false); assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } public void test03() throws MalformedURLException, IOException, TransformerException { readCatalog("src/test/resources/catalog03.xml"); URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = new File("src/test/resources/simple/ontology1.owl").toURI(); // needs trim because of a seemingly silly problem involving the URI for the outer xml base. checkBothAlgorithmsSame(u, true); assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } public void test04() throws MalformedURLException, IOException, TransformerException { readCatalog("src/test/resources/catalog04.xml"); URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = new File("src/test/resources/dir1/dir2/simple/ontology1.owl").toURI(); // The apache resolver behaves differently in Java 1.5 and Java 1.6 // I have aligned this library with the 1.6 behavior if (!JunitUtilities.isJava5()) { checkBothAlgorithmsSame(u, true); } assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } public void test05() throws MalformedURLException, IOException, TransformerException { readCatalog("src/test/resources/catalog05.xml"); URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = new File("src/test/resources/dir1/dir2/simple/ontology1.owl").toURI(); // The apache resolver behaves differently in Java 1.5 and Java 1.6 // I have aligned this library with the 1.6 behavior if (!JunitUtilities.isJava5()) { checkBothAlgorithmsSame(u, true); } assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } public void test06() throws MalformedURLException, IOException, TransformerException { readCatalog("src/test/resources/catalog06.xml"); URI u = URI.create("http://www.tigraworld.com/protege/pizza.owl"); // Predicting redirect is hard because it's system dependent. Windows adds a "C:". checkBothAlgorithmsSame(u, true); } public void test07() throws TransformerException, MalformedURLException, IOException { readCatalog("src/test/resources/catalog07.xml"); doTest07(); } public void test08() throws TransformerException, MalformedURLException, IOException { readCatalog("src/test/resources/catalog08.xml"); doTest07(); } public void test09() throws TransformerException, MalformedURLException, IOException { readCatalog("src/test/resources/catalog09.xml"); doTest07(); } private void doTest07() throws TransformerException { URI u = URI.create("http://www.tigraworld.com/protege/ontology1.owl"); URI redirect = URI.create("file:/home/tredmond/Shared/ontologies/simple/ontology1.owl"); checkBothAlgorithmsSame(u, false); assertTrue(CatalogUtilities.getRedirect(u, catalog).equals(redirect)); } private void readCatalog(String catalogLocation) throws MalformedURLException, IOException { System.setProperty("xml.catalog.ignoreMissing", "true"); CatalogManager manager = new CatalogManager(); manager.setUseStaticCatalog(false); manager.setCatalogFiles(catalogLocation); resolver = new CatalogResolver(manager); catalog = parseCatalog(new File(catalogLocation)); } protected XMLCatalog parseCatalog(File location) throws MalformedURLException, IOException { return CatalogUtilities.parseDocument(location.toURI().toURL()); } private void checkBothAlgorithmsSame(URI u, boolean trim) throws TransformerException { String result1 = resolver.resolve(u.toString(), null).getSystemId(); String result2 = CatalogUtilities.getRedirect(u, catalog).toString(); if (trim) { result1 = trimFileScheme(result1); result2 = trimFileScheme(result2); } assertTrue(result1.equals(result2)); } /* * This is a hack to avoid losing test cases because of differences like * file:/foo vs. file://foo. * I am not sure why these differences come up and am not sure if the second * version makes sense. */ private String trimFileScheme(String uri) { String filePrefix="file:"; if (uri.startsWith(filePrefix)) { uri = uri.substring(filePrefix.length()); while (uri.startsWith("/")) { uri = uri.substring(1); } } return uri; } } ResolveWithRoundTripTest.java000066400000000000000000000013221257170367500350720ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalogpackage org.protege.xmlcatalog; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import org.protege.xmlcatalog.parser.OuterXmlBaseContext; public class ResolveWithRoundTripTest extends ResolveTest { @Override protected XMLCatalog parseCatalog(File location) throws MalformedURLException, IOException { XMLCatalog catalog = super.parseCatalog(location); File tmpLocation = File.createTempFile("catalog-", ".xml"); CatalogUtilities.save(catalog, tmpLocation); catalog = CatalogUtilities.parseDocument(tmpLocation.toURI().toURL()); catalog.setXmlBaseContext(new OuterXmlBaseContext(location.toURI())); return catalog; } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/owlapi/000077500000000000000000000000001257170367500306215ustar00rootroot00000000000000IRIMapperTest.java000066400000000000000000000034411257170367500340370ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/java/org/protege/xmlcatalog/owlapipackage org.protege.xmlcatalog.owlapi; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.util.Set; import junit.framework.TestCase; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLImportsDeclaration; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyManager; public class IRIMapperTest extends TestCase { public final static IRI IMPORT_LOCATION = IRI.create("http://test.org/TestPizzaImport.owl"); public final static IRI PIZZA_IRI = IRI.create("http://www.co-ode.org/ontologies/pizza/pizza.owl"); public final static IRI REDIRECT_LOCATION = IRI.create("http://protege.stanford.edu/ontologies/pizza/pizza.owl"); public void testIRIMapper() throws MalformedURLException, IOException, OWLOntologyCreationException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); manager.addIRIMapper(new XMLCatalogIRIMapper(new File("src/test/resources/owl/redirect-to-pizza.xml"))); OWLOntology ontology = manager.loadOntology(IRI.create(new File("src/test/resources/owl/TestFunnyPizzaImport.owl"))); Set importDeclarations = ontology.getImportsDeclarations(); assertEquals(1, importDeclarations.size()); assertEquals(IMPORT_LOCATION, importDeclarations.iterator().next().getIRI()); Set importedOntologies = ontology.getImports(); assertEquals(1, importedOntologies.size()); OWLOntology pizzaOntology = importedOntologies.iterator().next(); assertEquals(PIZZA_IRI, pizzaOntology.getOntologyID().getOntologyIRI()); assertEquals(REDIRECT_LOCATION, manager.getOntologyDocumentIRI(pizzaOntology)); } } xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/000077500000000000000000000000001257170367500240305ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/Ambiguous.owl000066400000000000000000000020401257170367500265020ustar00rootroot00000000000000 ]>

xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/Example1.xml000066400000000000000000000021721257170367500262300ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/Example2.xml000066400000000000000000000004621257170367500262310ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog01.xml000066400000000000000000000003671257170367500263330ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog02.xml000066400000000000000000000003651257170367500263320ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog03.xml000066400000000000000000000003001257170367500263200ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog04.xml000066400000000000000000000002521257170367500263270ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog05.xml000066400000000000000000000003321257170367500263270ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog06.xml000066400000000000000000000003271257170367500263340ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog07.xml000066400000000000000000000004111257170367500263270ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog08.xml000066400000000000000000000003601257170367500263330ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/catalog09.xml000066400000000000000000000004251257170367500263360ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/dir1/000077500000000000000000000000001257170367500246675ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/dir1/dir2/000077500000000000000000000000001257170367500255275ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/dir1/dir2/catalog01.xml000066400000000000000000000003011257170367500300160ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/log4j.xml000066400000000000000000000016321257170367500255730ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/owl/000077500000000000000000000000001257170367500246315ustar00rootroot00000000000000xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/owl/TestFunnyPizzaImport.owl000066400000000000000000000022521257170367500315250ustar00rootroot00000000000000 ]> http://test.org/TestPizzaImport.owl xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/owl/redirect-to-pizza.xml000066400000000000000000000004351257170367500307310ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/pizza-xml.owl000066400000000000000000004363751257170367500265300ustar00rootroot00000000000000 ]> http://protege.stanford.edu/plugins/owl/protege An example ontology that contains all constructs required for the various versions of the Pizza Tutorial run by Manchester University (see http://www.co-ode.org/resources/tutorials/) en version 1.3 #American Americana #AmericanHot AmericanaPicante #AnchoviesTopping CoberturaDeAnchovies #ArtichokeTopping CoberturaDeArtichoke #AsparagusTopping CoberturaDeAspargos #Cajun Cajun #CajunSpiceTopping CoberturaDeCajun #CaperTopping CoberturaDeCaper #Capricciosa Capricciosa #Caprina Caprina #CheeseTopping CoberturaDeQueijo #CheeseyPizza Any pizza that has at least 1 cheese topping. #CheeseyPizza PizzaComQueijo #CheeseyVegetableTopping This class will be inconsistent. This is because we have given it 2 disjoint parents, which means it could never have any members (as nothing can simultaneously be a CheeseTopping and a VegetableTopping). NB Called ProbeInconsistentTopping in the ProtegeOWL Tutorial. #CheeseyVegetableTopping CoberturaDeQueijoComVegetais #ChickenTopping CoberturaDeFrango #Country A class that is equivalent to the set of individuals that are described in the enumeration - ie Countries can only be either America, England, France, Germany or Italy and nothing else. Note that these individuals have been asserted to be allDifferent from each other. #Country Pais #DeepPanBase BaseEspessa #Fiorentina Fiorentina #FishTopping CoberturaDePeixe #FourCheesesTopping CoberturaQuatroQueijos #FourSeasons QuatroQueijos #FruitTopping CoberturaDeFrutas #FruttiDiMare FrutosDoMar #GarlicTopping CoberturaDeAlho #Giardiniera Giardiniera #GoatsCheeseTopping CoberturaDeQueijoDeCabra #GorgonzolaTopping CoberturaDeGorgonzola #GreenPepperTopping CoberturaDePimentaoVerde #HamTopping CoberturaDePresunto #HerbSpiceTopping CoberturaDeErvas #Hot Picante #HotGreenPepperTopping CoberturaDePimentaoVerdePicante #HotSpicedBeefTopping CoberturaDeBifePicante #IceCream A class to demonstrate mistakes made with setting a property domain. The property hasTopping has a domain of Pizza. This means that the reasoner can infer that all individuals using the hasTopping property must be of type Pizza. Because of the restriction on this class, all members of IceCream must use the hasTopping property, and therefore must also be members of Pizza. However, Pizza and IceCream are disjoint, so this causes an inconsistency. If they were not disjoint, IceCream would be inferred to be a subclass of Pizza. #IceCream Sorvete #InterestingPizza Any pizza that has at least 3 toppings. Note that this is a cardinality constraint on the hasTopping property and NOT a qualified cardinality constraint (QCR). A QCR would specify from which class the members in this relationship must be. eg has at least 3 toppings from PizzaTopping. This is currently not supported in OWL. #InterestingPizza PizzaInteressante #JalapenoPepperTopping CoberturaDeJalapeno #LaReine LaReine #LeekTopping CoberturaDeLeek #Margherita Margherita #MeatTopping CoberturaDeCarne #MeatyPizza Any pizza that has at least one meat topping #MeatyPizza PizzaDeCarne #Medium Media #Mild NaoPicante #MixedSeafoodTopping CoberturaDeFrutosDoMarMistos #MozzarellaTopping CoberturaDeMozzarella #Mushroom Cogumelo #MushroomTopping CoberturaDeCogumelo #NamedPizza A pizza that can be found on a pizza menu #NamedPizza PizzaComUmNome #Napoletana Napoletana #NonVegetarianPizza Any Pizza that is not a VegetarianPizza #NonVegetarianPizza PizzaNaoVegetariana #NutTopping CoberturaDeCastanha #OliveTopping CoberturaDeAzeitona #OnionTopping CoberturaDeCebola #ParmaHamTopping CoberturaDePrezuntoParma #Parmense Parmense #ParmesanTopping CoberturaDeParmesao #PeperonataTopping CoberturaPeperonata #PeperoniSausageTopping CoberturaDeCalabreza #PepperTopping CoberturaDePimentao #PetitPoisTopping CoberturaPetitPois #PineKernels CoberturaPineKernels #Pizza Pizza #PizzaBase BaseDaPizza #PizzaTopping CoberturaDaPizza #PolloAdAstra PolloAdAstra #PrawnsTopping CoberturaDeCamarao #PrinceCarlo CoberturaPrinceCarlo #QuattroFormaggi QuatroQueijos #RealItalianPizza This defined class has conditions that are part of the definition: ie any Pizza that has the country of origin, Italy is a RealItalianPizza. It also has conditions that merely describe the members - that all RealItalianPizzas must only have ThinAndCrispy bases. #RealItalianPizza PizzaItalianaReal #RedOnionTopping CoberturaDeCebolaVermelha #RocketTopping CoberturaRocket #Rosa Rosa #RosemaryTopping CoberturaRosemary #SauceTopping CoberturaEmMolho #Siciliana Siciliana #SlicedTomatoTopping CoberturaDeTomateFatiado #SloppyGiuseppe SloppyGiuseppe #Soho Soho #Spiciness A ValuePartition that describes only values from Hot, Medium or Mild. NB Subclasses can themselves be divided up into further partitions. #Spiciness Tempero #SpicyPizza Any pizza that has a spicy topping is a SpicyPizza #SpicyPizza PizzaTemperada #SpicyPizzaEquivalent An alternative definition for the SpicyPizza which does away with needing a definition of SpicyTopping and uses a slightly more complicated restriction: Pizzas that have at least one topping that is both a PizzaTopping and has spiciness hot are members of this class. #SpicyPizzaEquivalent PizzaTemperadaEquivalente #SpicyTopping Any pizza topping that has spiciness Hot #SpicyTopping CoberturaTemperada #SpinachTopping CoberturaDeEspinafre #SultanaTopping CoberturaSultana #SundriedTomatoTopping CoberturaDeTomateRessecadoAoSol #SweetPepperTopping CoberturaDePimentaoDoce #ThinAndCrispyBase BaseFinaEQuebradica #TobascoPepperSauce MolhoTobascoPepper #TomatoTopping CoberturaDeTomate #UnclosedPizza An unclosed Pizza cannot be inferred to be either a VegetarianPizza or a NonVegetarianPizza, because it might have other toppings. #UnclosedPizza PizzaAberta #ValuePartition A ValuePartition is a pattern that describes a restricted set of classes from which a property can be associated. The parent class is used in restrictions, and the covering axiom means that only members of the subclasses may be used as values. The possible subclasses cannot be extended without updating the ValuePartition class. #ValuePartition ValorDaParticao #VegetableTopping CoberturaDeVegetais #VegetarianPizza Any pizza that does not have fish topping and does not have meat topping is a VegetarianPizza. Members of this class do not need to have any toppings at all. #VegetarianPizza PizzaVegetariana #VegetarianPizzaEquivalent1 Any pizza that only has vegetarian toppings or no toppings is a VegetarianPizzaEquiv1. Should be inferred to be equivalent to VegetarianPizzaEquiv2. Not equivalent to VegetarianPizza because PizzaTopping is not covering #VegetarianPizzaEquivalent1 PizzaVegetarianaEquivalente1 #VegetarianPizzaEquivalent2 An alternative to VegetarianPizzaEquiv1 that does not require a definition of VegetarianTopping. Perhaps more difficult to maintain. Not equivalent to VegetarianPizza #VegetarianPizzaEquivalent2 PizzaVegetarianaEquivalente2 #VegetarianTopping An example of a covering axiom. VegetarianTopping is equivalent to the union of all toppings in the given axiom. VegetarianToppings can only be Cheese or Vegetable or....etc. #VegetarianTopping CoberturaVegetariana #Veneziana Veneziana #hasIngredient NB Transitive - the ingredients of ingredients are ingredients of the whole #hasSpiciness A property created to be used with the ValuePartition - Spiciness. #isIngredientOf The inverse property tree to hasIngredient - all subproperties and attributes of the properties should reflect those under hasIngredient. xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/pizza.owl000066400000000000000000003761531257170367500257270ustar00rootroot00000000000000 ]> en version 1.3 An example ontology that contains all constructs required for the various versions of the Pizza Tutorial run by Manchester University (see http://www.co-ode.org/resources/tutorials/) NB Transitive - the ingredients of ingredients are ingredients of the whole A property created to be used with the ValuePartition - Spiciness. The inverse property tree to hasIngredient - all subproperties and attributes of the properties should reflect those under hasIngredient. Americana AmericanaPicante CoberturaDeAnchovies CoberturaDeArtichoke CoberturaDeAspargos Cajun CoberturaDeCajun CoberturaDeCaper Capricciosa Caprina CoberturaDeQueijo PizzaComQueijo Any pizza that has at least 1 cheese topping. CoberturaDeQueijoComVegetais This class will be inconsistent. This is because we have given it 2 disjoint parents, which means it could never have any members (as nothing can simultaneously be a CheeseTopping and a VegetableTopping). NB Called ProbeInconsistentTopping in the ProtegeOWL Tutorial. CoberturaDeFrango Pais A class that is equivalent to the set of individuals that are described in the enumeration - ie Countries can only be either America, England, France, Germany or Italy and nothing else. Note that these individuals have been asserted to be allDifferent from each other. BaseEspessa Fiorentina CoberturaDePeixe CoberturaQuatroQueijos QuatroQueijos CoberturaDeFrutas FrutosDoMar CoberturaDeAlho Giardiniera CoberturaDeQueijoDeCabra CoberturaDeGorgonzola CoberturaDePimentaoVerde CoberturaDePresunto CoberturaDeErvas Picante CoberturaDePimentaoVerdePicante CoberturaDeBifePicante Sorvete A class to demonstrate mistakes made with setting a property domain. The property hasTopping has a domain of Pizza. This means that the reasoner can infer that all individuals using the hasTopping property must be of type Pizza. Because of the restriction on this class, all members of IceCream must use the hasTopping property, and therefore must also be members of Pizza. However, Pizza and IceCream are disjoint, so this causes an inconsistency. If they were not disjoint, IceCream would be inferred to be a subclass of Pizza. PizzaInteressante 3 Any pizza that has at least 3 toppings. Note that this is a cardinality constraint on the hasTopping property and NOT a qualified cardinality constraint (QCR). A QCR would specify from which class the members in this relationship must be. eg has at least 3 toppings from PizzaTopping. This is currently not supported in OWL. CoberturaDeJalapeno LaReine CoberturaDeLeek Margherita CoberturaDeCarne PizzaDeCarne Any pizza that has at least one meat topping Media NaoPicante CoberturaDeFrutosDoMarMistos CoberturaDeMozzarella Cogumelo CoberturaDeCogumelo PizzaComUmNome A pizza that can be found on a pizza menu Napoletana PizzaNaoVegetariana Any Pizza that is not a VegetarianPizza CoberturaDeCastanha CoberturaDeAzeitona CoberturaDeCebola CoberturaDePrezuntoParma Parmense CoberturaDeParmesao CoberturaPeperonata CoberturaDeCalabreza CoberturaDePimentao CoberturaPetitPois CoberturaPineKernels Pizza BaseDaPizza CoberturaDaPizza PolloAdAstra CoberturaDeCamarao CoberturaPrinceCarlo QuatroQueijos PizzaItalianaReal This defined class has conditions that are part of the definition: ie any Pizza that has the country of origin, Italy is a RealItalianPizza. It also has conditions that merely describe the members - that all RealItalianPizzas must only have ThinAndCrispy bases. CoberturaDeCebolaVermelha CoberturaRocket Rosa CoberturaRosemary CoberturaEmMolho Siciliana CoberturaDeTomateFatiado SloppyGiuseppe Soho Tempero A ValuePartition that describes only values from Hot, Medium or Mild. NB Subclasses can themselves be divided up into further partitions. PizzaTemperada Any pizza that has a spicy topping is a SpicyPizza PizzaTemperadaEquivalente An alternative definition for the SpicyPizza which does away with needing a definition of SpicyTopping and uses a slightly more complicated restriction: Pizzas that have at least one topping that is both a PizzaTopping and has spiciness hot are members of this class. CoberturaTemperada Any pizza topping that has spiciness Hot CoberturaDeEspinafre CoberturaSultana CoberturaDeTomateRessecadoAoSol CoberturaDePimentaoDoce BaseFinaEQuebradica MolhoTobascoPepper CoberturaDeTomate PizzaAberta An unclosed Pizza cannot be inferred to be either a VegetarianPizza or a NonVegetarianPizza, because it might have other toppings. ValorDaParticao A ValuePartition is a pattern that describes a restricted set of classes from which a property can be associated. The parent class is used in restrictions, and the covering axiom means that only members of the subclasses may be used as values. The possible subclasses cannot be extended without updating the ValuePartition class. CoberturaDeVegetais PizzaVegetariana Any pizza that does not have fish topping and does not have meat topping is a VegetarianPizza. Members of this class do not need to have any toppings at all. PizzaVegetarianaEquivalente1 Any pizza that only has vegetarian toppings or no toppings is a VegetarianPizzaEquiv1. Should be inferred to be equivalent to VegetarianPizzaEquiv2. Not equivalent to VegetarianPizza because PizzaTopping is not covering PizzaVegetarianaEquivalente2 An alternative to VegetarianPizzaEquiv1 that does not require a definition of VegetarianTopping. Perhaps more difficult to maintain. Not equivalent to VegetarianPizza CoberturaVegetariana An example of a covering axiom. VegetarianTopping is equivalent to the union of all toppings in the given axiom. VegetarianToppings can only be Cheese or Vegetable or....etc. Veneziana xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/unit-tests.xml000066400000000000000000000012271257170367500266730ustar00rootroot00000000000000 xmlcatalog-org.protege.xmlcatalog-1.0.5/src/test/resources/versioned.owl000066400000000000000000000016471257170367500265610ustar00rootroot00000000000000 ]>