示例#1
0
        public void test6(string file)
        {
            IOwlParser parser = new OwlXmlParser();
            IOwlGraph graph = parser.ParseOwl(file);

            IOwlGenerator generator = new OwlXmlGenerator();
            generator.GenerateOwl(graph, @"c:\travelnew.owl");
        }
示例#2
0
        public void test2()
        {
            OwlGraph ontology = new OwlGraph();
            ontology.NameSpaces["xmlns:" + OwlNamespaceCollection.OwlNamespacePrefix] = OwlNamespaceCollection.OwlNamespace;
            ontology.NameSpaces["xmlns:" + OwlNamespaceCollection.RdfSchemaNamespacePrefix] = OwlNamespaceCollection.RdfSchemaNamespace;
            ontology.NameSpaces["xmlns:daml"] = "http://www.daml.org/2001/03/daml+oil#";
            ontology.NameSpaces["xmlns:dc"] = "http://purl.org/dc/elements/1.1/";
            ontology.NameSpaces["xmlns"] = "http://www.owl-ontologies.com/test.owl#";
            ontology.NameSpaces["xml:base"] = "http://www.owl-ontologies.com/test.owl";

            string baseUri = "http://www.owl-ontologies.com/test.owl#";

            OwlOntology o = new OwlOntology(baseUri + "testOntology");
            ontology.Nodes.Add(o);

            OwlClass a = new OwlClass(baseUri + "ClassA");
            ontology.Nodes.Add(a);

            OwlClass b = new OwlClass(baseUri + "ClassB");
            ontology.Nodes.Add(b);

            OwlEdge relation = new OwlEdge(OwlNamespaceCollection.RdfSchemaNamespace + "subClassOf");
            relation.AttachParentNode(a);
            relation.AttachChildNode(b);
            ontology.Edges.Add(relation);

            IOwlGenerator generator = new OwlXmlGenerator();
            generator.GenerateOwl(ontology, @"c:\example2.owl");
        }
示例#3
0
        public void test5(string file)
        {
            IOwlParser parser = new OwlXmlParser();
            IOwlGraph graph = parser.ParseOwl(file);

            string baseUri = "http://www.owl-ontologies.com/travel.owl#";
            OwlClass hotelNode = (OwlClass)graph.Nodes["http://www.owl-ontologies.com/travel.owl#LuxuryHotel"];

            OwlIndividual newHotel = new OwlIndividual(baseUri + "PellensPalace", hotelNode);
            graph.Nodes.Add(newHotel);

            IOwlGenerator generator = new OwlXmlGenerator();
            generator.GenerateOwl(graph, @"c:\travelnew.owl");
        }