亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? example08.java

?? 本體推理工具 共八個例子:從如何建立本體到做一些簡單的的本體推理
?? JAVA
字號:
package ex08;

import java.util.HashMap;

import org.semanticweb.kaon2.api.*;
import org.semanticweb.kaon2.api.logic.*;
import org.semanticweb.kaon2.api.reasoner.*;

/**
 * This example shows how to provide an ontology-based view over an existing relational database.
 * You should go through Example 1 before proceeding with this example.
 * Also, you should be familiar with the Java Database Connectivity (JDBC) technology.
 */
public class Example08 {
    /** The URI of the ontology descriptor. */
    public static String ONTOLOGY_DESCRIPTOR_URI="file:src/ex08/ontology_descriptor.xml";
    
    public static void main(String[] args) throws Exception {
        // Assume that you have a database containing a large amount of data, which you'd like to
        // convert into an ontology and access it by KAON2. You might do it by writing a prorpietary
        // converter, which dumps the contents of the database into an OWL file. However, such a
        // solution has a significant drawback: if the data changes, you'll need to run the conversion
        // process from scratch. Furthermore, if you have REALLY a lot of data, KAON2 might not be able
        // to load all of it into main memory. It therefore makes sense to leave this data in the
        // relational database, and provide an ontology view over it. KAON2 provides such a feature.
        // In fact, by providing a mapping of tables and fields of your database to ontology classes
        // and properties, you can create a "virtual" ontology. The ontology is virtual in the sense that
        // it is not materialized; rather, each time KAON2 needs instances of a certain concept or a property,
        // it will use the mapping and will directly access the database. Hence, if your data changes, the
        // changes are immediately visible to KAON2. Furthermore, KAON2 does not need to load entire data
        // into main memory, which greatly increases the scalability of KAON2. In this example you'll learn
        // how to create the mapping, and how to open and with with the virtual ontology.
        
        // Before you proceed, you need to perform the following preparation steps. 
        // 1. Create a new test database.
        // 2. Execute the SQL script schema_and_data.sql supplied with this example. This script
        //    will create the database schema and fill it with some test data.
        // 3. Download the JDBC driver for your database, and put it in your class path. If you
        //    use the supplied ANT script to run the example, then modify the "JDBCpath" classpath
        //    to point to the correct location of your driver.
        // 4. Update the database connection string, the user name, the password, and the driver class name
        //    in the supplied "ontology_descriptor.xml" file.
        // 5. Recompile the examples, so that these changes come into effect.
        //
        // The file "ontology_descriptor.xml" contains the definition of the virtual ontology.
        // The attribute db:name of the db:DBOntology element defines the ontology URI.
        // The element db:Database contains information used to connect to a database. For connecting
        // to MSSQL Server, you should additionally append to this element the following attribute:
        //     db:databaseType="MSSQL"
        // The rest of the file is simply a set of mappings of various OWL elements to tables and fields.
        // Notice that for each field you need to specify a type, which must match the type of the field
        // in the database. Currently supported types are:
        //     db:String, db:Integer, db:Short, db:Byte, db:Float, db:Double, db:Boolean, and db:Date
        //
        // Certain fields in the database may be mapped to individuals. Usually, the fields in the databse
        // will not contain full individual URIs. Hence, you can specify using the db:uriPrefix attribute
        // a prefix for the URIs of individuals obtained from the table. For example, if you specify
        // db:uriPrefix="http://test.com/ontology#p", then if a field contains the value "14", the URI of the
        // individual obtained from this field will be "http://test.com/ontology#p14". Fields mapped to
        // individuals can be of either integer (mapped using db:IndividualInteger element) or string
        // (mapped using db:IndividualString element) type.
        //
        // If a field acts as a primary key for a table, you should specify db:primaryKey="true" attribute.
        // This is not strictly required, but may be used by KAON2 for optimizations. Compound primary
        // keys are currently not supported, so for such fields simply omit the db:primaryKey attribute.
        //
        // The following mapping types can be used:
        // 
        // - db:OWLClass maps a class to a field in a table
        // - db:ObjectProperty maps an object property to a pair of individuals in a table
        // - db:DataProperty and db:AnnotationProperty map a data property to an
        //   (individual,value) pair in a table
        // - db:SameIndividual and db:DifferentIndividuals specify the extensions of equality predicates
        //   (both must me mapped to pairs or individuals)
        // - db:PredicateSymbol maps a predicate symbols to the appropriate extension
        // - db:HerbrandUniverse provides a mapping to a table containing all individuals in a database.
        //   Such a mapping is needed in order to answer some advanced OWL queries. If you do not provide
        //   such a mapping, then some queries will throw an exception. This mapping is needed to answer
        //   some queries in ontologies that use either equality or negation.
        //
        // A virtual ontology can contain only assertions about individuals; it cannot contain any axioms
        // about classes or properties. Furthermore, it cannot include another ontology, but it can be
        // included in some other ontology. Hence, you should specify the classes and axioms in a file-based
        // ontology as usual; then, you can include the virtual ontology into it to provide the individuals.
        //
        // A virtual ontology is read-only. If you want to change the class memberships and relations stored
        // in it, you should do it outside of KAON2.
        //
        // An ontology descriptor file is used as any other file-based ontology. You can open it as usual,
        // by creating a resolver, registering the physical URI of the ontology, and then opening the ontology. 
        DefaultOntologyResolver resolver=new DefaultOntologyResolver();
        String ontologyURI=resolver.registerOntology(ONTOLOGY_DESCRIPTOR_URI);
        KAON2Connection connection=KAON2Manager.newConnection();
        connection.setOntologyResolver(resolver);
        Ontology ontology=connection.openOntology(ontologyURI,new HashMap<String,Object>());
        
        // Once you opened an ontology, you can access it just like you would access an ordinary ontology.
        // For example, you can ask some queries:
        System.out.println("  Query results:");
        System.out.println("-----------------------------------");
        Reasoner reasoner=ontology.createReasoner();
        Query query=reasoner.createQuery(Namespaces.INSTANCE,"SELECT ?x ?y ?z ?w WHERE { ?x rdf:type <http://test.com/ontology#Person> ; <http://test.com/ontology#personHasName> ?y ; <http://test.com/ontology#personHasParent> ?z . ?z <http://test.com/ontology#personHasName> ?w }");
        query.open();
        Term[] tupleBuffer=query.tupleBuffer();
        while (!query.afterLast()) {
            System.out.print("[ ");
            for (int i=0;i<tupleBuffer.length;i++) {
                if (i!=0)
                    System.out.print(", ");
                System.out.print(tupleBuffer[i]);
            }
            System.out.println(" ]");
            query.next();
        }
        System.out.println("-----------------------------------");
        query.dispose();
        reasoner.dispose();
        
        // You can also iterate through the axioms in the ontology:
        System.out.println();
        System.out.println("  Axioms of the ontology:");
        System.out.println("-----------------------------------");
        Cursor<Axiom> cursor1=ontology.createAxiomRequest().openCursor();
        while (cursor1.hasNext()) {
            Axiom axiom=cursor1.next();
            System.out.println(axiom.toString());
        }
        System.out.println("-----------------------------------");
        cursor1.close();
        
        // The retrieval functionality works as usual. For example, you can select the axioms just for some objects: 
        System.out.println();
        System.out.println("  Facts about 'http://test.com/ontology#p1':");
        System.out.println("-----------------------------------");
        Cursor<Literal> cursor2=ontology.createAxiomRequest(Literal.class).setCondition("argument",0,KAON2Manager.factory().individual("http://test.com/ontology#p1")).openCursor();
        while (cursor2.hasNext()) {
            Axiom axiom=cursor2.next();
            System.out.println(axiom.toString());
        }
        System.out.println("-----------------------------------");
        cursor2.close();
        
        // Do not forget to clean-up, or your connections to the database will not be released!
        connection.close();
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男女男精品视频网| 欧美日韩亚洲综合一区二区三区| 日韩女优毛片在线| av电影天堂一区二区在线| 亚洲欧美中日韩| 欧美中文字幕一区| 成人动漫一区二区| 成人app在线观看| 91污片在线观看| 成人激情黄色小说| 在线免费观看成人短视频| 色综合久久88色综合天天免费| 91香蕉视频在线| 欧美日韩高清一区二区不卡| 欧美日本不卡视频| 日韩亚洲国产中文字幕欧美| 日韩一级大片在线观看| 日韩欧美国产高清| 久久久久久久久久久久久久久99| 日韩女优毛片在线| 亚洲精品自拍动漫在线| 日本亚洲一区二区| 麻豆免费看一区二区三区| 欧美a一区二区| 91丨九色丨国产丨porny| 欧美精品亚洲一区二区在线播放| 精品日韩在线一区| 亚洲综合久久av| 成人av电影在线| 欧美一级欧美一级在线播放| 久久久久久日产精品| 蜜臀av一级做a爰片久久| www.亚洲人| 久久久噜噜噜久久中文字幕色伊伊| 国产欧美一区二区三区沐欲| 一区二区三区免费看视频| 国产成人精品aa毛片| 国产亚洲精品超碰| 国产在线精品不卡| 欧美激情资源网| 成人亚洲一区二区一| 久久精品无码一区二区三区| 国产成人午夜精品影院观看视频 | 欧美xxx久久| 亚洲伦在线观看| 岛国一区二区三区| 亚洲精品在线观看网站| 处破女av一区二区| 欧洲一区在线电影| 69久久99精品久久久久婷婷| 在线不卡欧美精品一区二区三区| 99久久综合狠狠综合久久| 色婷婷一区二区三区四区| 欧美日韩一区二区三区在线看| 欧美一级生活片| 中文字幕在线不卡| 免费不卡在线观看| 色菇凉天天综合网| 日韩视频在线一区二区| www久久精品| 亚洲国产毛片aaaaa无费看| 日韩精品久久理论片| 成人激情校园春色| 欧美午夜精品电影| 中文字幕不卡一区| 午夜精品久久久久久不卡8050| 视频一区中文字幕国产| 99这里只有精品| 欧美精品一区二区不卡| 亚洲自拍另类综合| 高清视频一区二区| 精品日产卡一卡二卡麻豆| 樱桃视频在线观看一区| 春色校园综合激情亚洲| 欧美不卡123| 亚洲成人在线免费| 欧美日产在线观看| 亚洲韩国一区二区三区| 99久久伊人网影院| 国产三级一区二区| 国产激情精品久久久第一区二区| 欧美日韩一级视频| 亚洲精品视频观看| av资源网一区| 午夜伊人狠狠久久| 久久精品视频免费| av在线播放不卡| 亚洲久本草在线中文字幕| 制服丝袜亚洲播放| 六月丁香婷婷久久| 久久日韩粉嫩一区二区三区| 国产大陆精品国产| 中文字幕第一页久久| 97久久精品人人澡人人爽| 亚洲特级片在线| 在线不卡一区二区| 精彩视频一区二区| 久久久亚洲欧洲日产国码αv| 国产成人精品亚洲777人妖| 亚洲精选视频免费看| 欧美大胆人体bbbb| 欧美在线你懂得| 国产一区二区视频在线| 日韩电影在线观看电影| 中文字幕色av一区二区三区| 日本精品视频一区二区| 麻豆精品视频在线观看| 国产精品国产三级国产aⅴ中文 | 欧美肥妇bbw| 国产成人精品免费看| 午夜精品免费在线观看| 国产精品美女久久久久高潮 | 免费欧美高清视频| 天堂av在线一区| 亚洲欧美视频在线观看| 亚洲国产精品黑人久久久| 91精品国产入口在线| 色狠狠色狠狠综合| 91伊人久久大香线蕉| 国产成+人+日韩+欧美+亚洲| 美女网站色91| 日本大胆欧美人术艺术动态| 中文字幕中文字幕一区| 日韩理论在线观看| 亚洲免费观看高清| 一区二区不卡在线视频 午夜欧美不卡在| 国产精品午夜免费| 国产亚洲午夜高清国产拍精品| 日韩精品一区二区三区视频在线观看| 在线不卡a资源高清| 欧美日韩视频不卡| 91在线无精精品入口| 欧美性生活一区| 国产午夜精品在线观看| 玉足女爽爽91| 日韩av网站免费在线| 成人av网址在线观看| 欧美福利电影网| 日韩欧美国产不卡| 中文在线资源观看网站视频免费不卡| 91精品国产综合久久久久久久 | 日韩视频国产视频| 亚洲欧洲精品一区二区三区| 亚洲激情图片小说视频| 麻豆精品久久精品色综合| 99精品久久99久久久久| 欧美色精品在线视频| 久久综合久久综合亚洲| 国产精品网站一区| 日韩**一区毛片| 欧美视频中文一区二区三区在线观看| 欧美日本乱大交xxxxx| 国产精品蜜臀av| 青青草国产成人99久久| 99视频国产精品| 亚洲精品一区二区三区蜜桃下载| 国产精品欧美一区喷水| 激情久久五月天| 欧美色精品在线视频| 亚洲久本草在线中文字幕| 国产福利一区在线| 欧美一区三区四区| 性做久久久久久久久| 99精品欧美一区二区三区小说 | 欧美日韩亚洲丝袜制服| 国产精品理伦片| 国产一区二区三区香蕉| 91麻豆精品国产91久久久更新时间 | 欧美日韩中字一区| 五月天婷婷综合| 欧美高清hd18日本| 久久99久久久欧美国产| 欧美一区二区精品在线| 亚洲男人天堂一区| 99re热这里只有精品视频| 中文字幕在线观看不卡| 欧美午夜片在线观看| 午夜久久福利影院| 在线综合+亚洲+欧美中文字幕| 亚洲一区在线观看网站| 欧美一卡二卡在线| www.亚洲精品| 精品一区二区三区欧美| 亚洲国产精品精华液2区45| 91激情五月电影| 国产一区二区毛片| 亚洲va中文字幕| 国产视频不卡一区| 91精品国产入口| 成人黄页在线观看| 男女男精品视频网| 一区二区三区日韩精品| 国产日韩av一区| 国产精品第四页| 精品国产三级电影在线观看| 91在线无精精品入口| 麻豆传媒一区二区三区| 综合自拍亚洲综合图不卡区| 欧美日本免费一区二区三区| 福利一区二区在线|