Package org.semanticweb.owl.vocab

Examples of org.semanticweb.owl.vocab.NamespaceOWLOntologyFormat


    public void render(OWLOntology ontology, Writer writer) throws OWLRendererException {
        ManchesterOWLSyntaxFrameRenderer ren = new ManchesterOWLSyntaxFrameRenderer(getOWLOntologyManager(), ontology, writer);
        OWLOntologyFormat format = getOWLOntologyManager().getOntologyFormat(ontology);
        if(format instanceof NamespaceOWLOntologyFormat) {
            NamespaceOWLOntologyFormat namespaceFormat = (NamespaceOWLOntologyFormat) format;
            Map<String, String> prefixMap = namespaceFormat.getNamespacesByPrefixMap();
            for(String prefix : prefixMap.keySet()) {
                ren.getNamespaceManager().setPrefix(prefix, prefixMap.get(prefix));
            }
        }
        ren.writeOntology();
View Full Code Here



    private void processOntology() {
        namespaceUtil = new NamespaceUtil();
        if (ontologyFormat instanceof NamespaceOWLOntologyFormat) {
            NamespaceOWLOntologyFormat namespaceFormat = (NamespaceOWLOntologyFormat) ontologyFormat;
            Map<String, String> namespacesByPrefix = namespaceFormat.getNamespacesByPrefixMap();
            for (String prefix : namespacesByPrefix.keySet()) {
                if (prefix.length() > 0) {
                    namespaceUtil.setPrefix(namespacesByPrefix.get(prefix), prefix);
                }
            }
            String defaultNamespace = namespaceFormat.getDefaultNamespace();
            if (defaultNamespace != null) {
                setDefaultNamespace(defaultNamespace);
            }
        }
        if (!ontology.getRules().isEmpty()) {
View Full Code Here

        try {
            OWLOntologyNamespaceManager nsm = new OWLOntologyNamespaceManager(getOWLOntologyManager(), ontology);
            nsm.setDefaultNamespace(Namespaces.OWL2XML.toString());
            nsm.setPrefix("owl2xml", Namespaces.OWL2XML.toString());
            if(format instanceof NamespaceOWLOntologyFormat) {
                NamespaceOWLOntologyFormat namespaceFormat = (NamespaceOWLOntologyFormat) format;
                final Map<String,String> nsByPrefixMap = namespaceFormat.getNamespacesByPrefixMap();
                for(String prefix : nsByPrefixMap.keySet()) {
                    String ns = nsByPrefixMap.get(prefix);
                    if(ns != null && ns.length() > 0) {
                       nsm.setPrefix(prefix, ns);
                    }
                }
                if(namespaceFormat.getDefaultNamespace() != null) {
                    nsm.setDefaultNamespace(namespaceFormat.getDefaultNamespace());
                }
            }
            OWLXMLWriter w = new OWLXMLWriter(writer, nsm, ontology);
            w.startDocument(ontology);
            OWLXMLObjectRenderer ren = new OWLXMLObjectRenderer(ontology, w);
View Full Code Here

TOP

Related Classes of org.semanticweb.owl.vocab.NamespaceOWLOntologyFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.