小编dil*_*00o的帖子

从rdf模型将本体读入GraphX

我正在尝试通过利用 owl/RDF 格式使用 Spark (GraphX) 构建基于图形的 uniprot 数据视图。我正在尝试使用 apache jena 解析数据,但我无法理解 rdf 文件的结构。为了更好地说明,这里有一个我正在尝试处理的文件类型的示例。 http://pastebin.com/iSeGs0RZ

为了我的需要,我必须存储/操作例如
通过我需要保存令牌“seeAlso”和?predicate?“ http://purl.uniprot.org/string/9606.ENSP00000418960 ”尝试在 java/scala 中加载模型时 print(model) 显示大部分信息,但我找不到从文件中提取所有内容的方法.

这是我用来在模型中读取的内容: object runner { val inputFileName = "dataset/test2.xml"

  def main(args: Array[String]) {
    val model = ModelFactory.createDefaultModel()

    // use the FileManager to find the input file
    val in = FileManager.get().open(inputFileName)
    if (in == null) {
      throw new IllegalArgumentException(
        "File: " + inputFileName + " not found")
    }
    model.read(in, "RDF/XML")
    val items = model.listObjects()
    var count = 0
    while (items.hasNext) …
Run Code Online (Sandbox Code Playgroud)

java rdf scala owl jena

5
推荐指数
0
解决办法
678
查看次数

标签 统计

java ×1

jena ×1

owl ×1

rdf ×1

scala ×1