• 大小: 22.21MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-20
  • 语言: Java
  • 标签: jena-2.6.4  

资源简介

这是jena-2.6.4官方版本的jar包,我亲自用过了,效果很好!

资源截图

代码片段和文件信息


import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.sax.*;
import org.xml.sax.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;
import com.hp.hpl.jena.rdf.arp.*;
import com.hp.hpl.jena.rdf.model.*;

/**
 * @author Jeremy J. Carroll
 *  
 */
public class DOM2Jena {

public static void main(String args[]) throws Exception {

// Create DOM:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    // DOM must have namespace information inside it!
factory.setNamespaceAware(true);
DocumentBuilder domParser = factory.newDocumentBuilder();
Document document = domParser
.parse(new File(“testing/wg/Manifest.rdf“));
// Make DOM into transformer input
Source input = new DOMSource(document);

// Make SAX2Model SAX event handler
Model m = ModelFactory.createDefaultModel();
SAX2Model handler = SAX2Model.create(
“http://www.w3.org/2000/10/rdf-tests/rdfcore/Manifest.rdf“ m);


// Make a SAXResult object using this handler
SAXResult output = new SAXResult(handler);
output.setLexicalHandler(handler);

// Run transform
TransformerFactory xformFactory = TransformerFactory.newInstance();
Transformer idTransform = xformFactory.newTransformer();
idTransform.transform(input output);

// Use Model
m.write(System.out “N-TRIPLE“);
}

}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-12-12 16:57  Jena-2.6.4\
     文件         634  2004-02-04 15:39  Jena-2.6.4\INSTALL.txt
     文件       64056  2010-06-01 17:02  Jena-2.6.4\ReleaseNotes.txt
     文件         312  2004-02-04 15:39  Jena-2.6.4\README.txt
     文件         690  2004-11-15 16:36  Jena-2.6.4\readme.html
     文件        1652  2008-12-28 19:32  Jena-2.6.4\copyright.txt
     目录           0  2010-12-12 16:57  Jena-2.6.4\lib\
     文件     2217681  2010-12-12 14:17  Jena-2.6.4\lib\arq-2.8.7.jar
     文件       26514  2009-08-01 18:21  Jena-2.6.4\lib\stax-api-1.0.1.jar
     文件      524224  2009-08-01 18:21  Jena-2.6.4\lib\wstx-asl-3.2.9.jar
     文件      665064  2009-08-01 18:21  Jena-2.6.4\lib\lucene-core-2.3.1.jar
     目录           0  2010-12-12 16:57  Jena-2.6.4\lib-src\
     文件      210961  2010-12-12 16:57  Jena-2.6.4\lib-src\iri-0.8-sources.jar
     文件     2307106  2010-12-12 16:57  Jena-2.6.4\lib-src\jena-2.6.4-sources.jar
     文件     1507851  2010-12-12 16:57  Jena-2.6.4\lib\jena-2.6.4-tests.jar
     文件     3538692  2010-12-12 16:57  Jena-2.6.4\jena-2.6.4-javadoc.jar
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\regression\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\regression\testNTripleReader\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\regression\testWriterAndReader\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\regression\testReaderInterface\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\regression\testModelEquals\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\AnnotationProperty\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\differentFrom\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\rdfs-no-cycles-in-subPropertyOf\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\equivalentClass\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\rdfms-xmllang\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\I5.5\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\backwardCompatibleWith\
     目录           0  2010-08-23 21:12  Jena-2.6.4\testing\wg\rdfms-syntax-incomplete\
............此处省略3960个文件信息

评论

共有 条评论

相关资源