Jena TDB assembler syntax
2024-10-20 20:52:00
1 introduction
Assembler is a DSL of Jena to specify something to build, models and dataset, for example.
2 examples
Jena Assembler's syntax seems like turtle, here is commonly used prefixes:
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
2.1 dataset
// trigger TDB initialization
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
// specification of the TDB dataset
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;// location, relative to CWD
.
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
// set the default graph for query is the union of named graphs
tdb:unionDefaultGraph true ;
.
2.2 graph
It's for the purpose of working with a single graph in TDB's RDF dataset.
the default graph
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
<#graph> rdf:type tdb:GraphTDB ;
tdb:dataset <#dataset> .
the named graph
<#graphNamed> rdf:type tdb:GraphTDB ;
tdb:dataset <#dataset> .
tdb:graphName <http://example/graph1> ;
.
2.3 mixed datasets
It's for the purpose of a dataset may be composed of different sourced graphs.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
<#dataset> rdf:type ja:RDFDataset ;
ja:defaultGraph <#graph> ;// the default graph
ja:namedGraph // the named graph
[ ja:graphName <http://example.org/name1> ;
ja:graph <#graph2> ] ;
.
<#graph> rdf:type tdb:GraphTDB ;
tdb:location "DB" ;
.
// a graph using external sources
<#graph2> rdf:type ja:MemoryModel ;
ja:content [ja:externalContent <file:Data/books.n3> ] ;
.
Note ja:RDFDataset and ja:Model support more settings of datasets and models.
3 related namespaces
ja
com.hp.hpl.jena.assembler.JA(jena-core-2.11.1-sources.jar)
tdb
com.hp.hpl.jena.tdb.assembler.VocabTDB(jena-tdb-1.0.1-sources.jar)
最新文章
- vcf格式
- 使用 Redis 实现分布式锁
- Java Gradle入门指南之内建与定制任务类(buildSrc、Groovy等)
- iOS -类目,延展,协议
- Ubantu16.4的安装过程以及基本配置
- SVN 文件解锁
- asp.net的JSON数据进行序列化和反序列化
- 在Windows/Ubuntu下安装OpenGL环境(GLUT/freeglut)与跨平台编译(mingw/g++)
- Wireshark技巧-过滤规则和显示规则
- Ubuntu开机启动svn
- C与C++动态分配二维数组
- ros消息时间同步与回调
- chrome误删书签恢复。
- ORA-12545: Connect failed because target host or object does not exist
- python 关于django 2.X from django.contrib.auth.views import login
- jmeter中文乱码及Unicode转中文
- Cannot Connect to Database Server
- 移动端的dl
- Windows下安装MySql5.7(解压版本)
- Python之socket_tcp