Edzy_Java

            BlogJava :: 首頁 ::  ::  ::  :: 管理 ::
            58 隨筆 :: 12 文章 :: 11 評論 :: 0 Trackbacks

          //讀RDF的程序
          import com.hp.hpl.jena.rdf.model.*;
          import java.io.*;

          public class read-rdf extends Object{

          ??? static final String inputFileName
          ?????????????????????????? = "i'm-rdf-file.rdf";

          ??? public static void main (Sring args[]){

          ??????? try? {

          ?????????? Model model = ModelFactory.createDefaultModel();

          ?????????? InputStream in = read-rdf.class
          ??????????????????????????????????? .getClassLoader()
          ??????????????????????????????????? .getResourceAsStream(inputFileName);

          ?????????? if (in == null) {
          ?????????????? throw new IllegalArgumentException(
          ?????????????????????? "file:" + inputFileName +"not found");
          ???????????? }

          ?????????? model.read(new InputStreamReader(in), "");

          ?????????? model.write(System.out);

          ??????? }
          ??? }

          //寫RDF的程序
          import com.hp.hpl.jena.rdf.model.*;
          import java.io.*;
          import com.hp.hpl.jena.xmloutput.*;

          public static void main (String args[]){

          ??????? String programstype?? = "Jena";
          ??????? String writername???? = "xiaoxiao";
          ??????? String things???????? = "make the program";
          ??????? String task?????????? = writername + " " + things;
          ????
          ??????? try{
          ?????????? Model model = ModelFactory.createDefaultModel()??
          ?????????
          ?????????? Resource xiaoxiao
          ????????????? = model.createResource(programstype)
          ???????????????????? .addProperty(TASKS, task)
          ????????????????????????? model.createResource()
          ?????????????????????????????? .addProterty(WRITER, writername)

          ???????????? RDFWriter writer = model.getWriter();
          ???????????? writer.write(model,System.out, null);

          ??????????? }
          }

          posted on 2006-11-15 17:05 lbfeng 閱讀(232) 評論(0)  編輯  收藏 所屬分類: J2SE技術(shù)雜談

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 宜昌市| 大余县| 哈密市| 墨玉县| 剑阁县| 浙江省| 九台市| 庆云县| 文水县| 翁源县| 天气| 岳阳市| 松桃| 达拉特旗| 仁布县| 石棉县| 朝阳区| 湟中县| 杂多县| 库车县| 西藏| 洪雅县| 瑞安市| 财经| 洛阳市| 津市市| 津南区| 石屏县| 方正县| 黎城县| 柘城县| 松阳县| 阿合奇县| 鹤壁市| 腾冲县| 招远市| 兰州市| 南开区| 凉山| 鄂托克旗| 杨浦区|