Esempio n. 1
0
 public static string ConvertNameNode(OwlEdge owlEdge)
 {
     string[] name = owlEdge.ID.Split('#');
     if (name.Length > 1)
     {
         return(name[1]);
     }
     else
     {
         return("Нет Вершины!!! Ошибка!!!");
     }
 }
Esempio n. 2
0
        public void test8()
        {
            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#";

            OwlClass testCls = new OwlClass(baseUri + "TestClass");

            ontology.Nodes.Add(testCls);
            OwlRestriction testRestriction = new OwlRestriction("blankID:1");

            ontology.Nodes.Add(testRestriction);
            OwlObjectProperty testProp = new OwlObjectProperty(baseUri + "testProp");

            ontology.Nodes.Add(testProp);

            OwlEdge subClassOfRelation = new OwlEdge(OwlNamespaceCollection.RdfSchemaNamespace + "subClassOf");

            subClassOfRelation.AttachParentNode(testCls);
            subClassOfRelation.AttachChildNode(testRestriction);
            ontology.Edges.Add(subClassOfRelation);

            OwlEdge onPropertyRelation = new OwlEdge(OwlNamespaceCollection.OwlNamespace + "onProperty");

            onPropertyRelation.AttachParentNode(testRestriction);
            onPropertyRelation.AttachChildNode(testProp);
            ontology.Edges.Add(onPropertyRelation);

            OwlLiteral val = new OwlLiteral("1", null, "http://www.w3.org/2001/XMLSchema#int");

            OwlEdge cardinalityRelation = new OwlEdge(OwlNamespaceCollection.OwlNamespace + "cardinality");

            cardinalityRelation.AttachParentNode(testRestriction);
            cardinalityRelation.AttachChildNode(val);
            ontology.Edges.Add(cardinalityRelation);

            IOwlGenerator generator = new OwlXmlGenerator();

            generator.GenerateOwl(ontology, @"c:\test.owl");
        }