我正在使用Jena ARQ编写针对从Jena TDB读取的大型本体的SPARQL查询,以便找到与基于rdfs标签的概念相关联的类型:
SELECT DISTINCT ?type WHERE {
?x <http://www.w3.org/2000/01/rdf-schema#label> "aspirin" .
?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .
}
Run Code Online (Sandbox Code Playgroud)
这很好用,实际上非常快(<1秒).不幸的是,对于某些术语,我需要以不区分大小写的方式执行此查询.例如,因为标签"Tylenol"位于本体中,而不是"tylenol",所以以下查询为空:
SELECT DISTINCT ?type WHERE {
?x <http://www.w3.org/2000/01/rdf-schema#label> "tylenol" .
?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .
}
Run Code Online (Sandbox Code Playgroud)
我可以使用FILTER语法编写此查询的不区分大小写的版本,如下所示:
SELECT DISTINCT ?type WHERE {
?x <http://www.w3.org/2000/01/rdf-schema#label> ?term .
?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .
FILTER ( regex (str(?term), "tylenol", "i") )
}
Run Code Online (Sandbox Code Playgroud)
但现在查询需要一分钟才能完成!有没有办法以更有效的方式编写不区分大小写的查询?
我正在查询推文的数据集:
SELECT * WHERE {
?tweet smo:tweeted_at ?date ;
smo:has_hashtag ?hashtag ;
smo:tweeted_by ?account ;
smo:english_tweet true .
FILTER ( ?date >= "20130722"^^xsd:date && ?date < "20130723"^^xsd:date )
}
Run Code Online (Sandbox Code Playgroud)
如果推文有多个主题标签,则每个主题标签的结果集中有一行.我有什么方法可以将主题标签聚合成一个数组吗?
我正在阅读"Lisp的土地"(顺便说一下,这是我读过的最好的技术书籍之一)我遇到了关联列表
(defparameter *edges*
'((living-room (garden west door)
(attic upstairs ladder))
(garden (living-room east door))
(attic (living-room downstairs ladder))))
Run Code Online (Sandbox Code Playgroud)
首先,Lisp中的关联列表与Java的Map(键值绑定)相同吗?
对于客厅钥匙,如何拥有多个价值?为什么不用列表包含值:
(living-room ((garden west door) (attic upstairs ladder)))
Run Code Online (Sandbox Code Playgroud) 我需要将这个40MB的RDF/XML文件转换为JSON-LD格式,我只找到了这个根本不起作用的网络工具.当您粘贴40MB的文本时,它会崩溃,当您为其提供文件的URL时,它会说该服务不可用.
从理论上讲耶拿API,也许芝麻应该是能够做到这一点,但我缺少一个起点,对这些系统的知识.有人可以给我一个路线,一个示例或链接到有用的文档,以便将大型RDF/XML转换为JSON-LD吗?
(我对Java,C#或一个工作解决方案感到满意,我不需要在另一种语言/框架中有太多的编程知识).
如果我创建一个新的XML文件(使用默认的Android Studio"创建线性布局"),Studio会生成一个包含内容的文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
如果我(右) - 单击"分析...→检查代码",结果窗口将抛出2次:"命名空间未绑定"并引用第3行和第7行(LinearLayout-tags).它是Studio中的错误吗?
在下面的SPARQL查询中,我不确定如何使用if两个字符串中的一个绑定到变量?result.我听说有"范围"和"超出范围"的概念,但我并没有真正看到差异.我也尝试将该if条款放在select行中,但它也没有用.如何根据条件修复此查询以绑定?result到两个字符串之一?
SELECT ?result
WHERE{
?chain rdf:type rdfs:Property .
?chain rdfs:domain <http://www.vs.cs.hs-rm.de/ontostor/SVC#MDiskGroup> .
?chain rdfs:range <http://www.vs.cs.hs-rm.de/ontostor/SVC#IOgroup> .
?this ?chain ?arg .
?arg io:id ?var .
IF(?var = "0"^^xsd:integer,
BIND(" *"^^xsd:string AS ?result),
BIND(""^^xsd:string AS ?result)) .
}
Run Code Online (Sandbox Code Playgroud) [解决了]
我有安装php 5.4.18的Debian Wheezy.我想将它升级到5.5.x,但标准程序无法正常工作.
这是我的/etc/apt/sources.list文件:
# deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
deb http://ftp.pl.debian.org/debian/ wheezy main
deb-src http://ftp.pl.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
# wheezy-updates, previously known as 'volatile'
deb http://ftp.pl.debian.org/debian/ wheezy-updates main
deb-src http://ftp.pl.debian.org/debian/ wheezy-updates main
#php 5.5
deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all
Run Code Online (Sandbox Code Playgroud)
我更新了源代码
apt-get update
Run Code Online (Sandbox Code Playgroud)
并安装了php5
apt-get install php5
Run Code Online (Sandbox Code Playgroud)
但在httpd重启后我还有旧的php版本.
php -v
Run Code Online (Sandbox Code Playgroud)
收益:
root@xxx:/# php -v
PHP 5.4.18 (cli) (built: Aug 19 2013 …Run Code Online (Sandbox Code Playgroud) 我想用香蕉RDF在我的项目,最好通过将其定义为在依赖build.scala使用dependsOn:
lazy val root = Project("root", file(".")) dependsOn RootProject(uri("git://github.com/w3c/banana-rdf"))
Run Code Online (Sandbox Code Playgroud)
但是,banana-rdf是一个多项目,因此需要以不同的方式组合.从我所看到的,这些多项目定义只允许您将项目位置指定为文件路径,并且不允许URI.
问题:我是否正确地说我必须将这些多项目GIT依赖项克隆到我的项目中并将它们作为文件夹引用?
我更喜欢将所有GIT克隆留给SBT的想法,并将这些克隆到某个tmp SBT文件夹而不是混乱我的项目......
我现在对Python中的lambda运算符有点困惑.以下(工作)代码在所有元组的第一个元素上出现元组第一个元素的次数之后对元组列表进行排序:
tuples = [(2, 1, 8, 4), (3, 4, 8, 1), (3, 8, 1, 4), (4, 1, 8, 3),
(4, 8, 1, 3), (8, 8, 3, 1), (8, 1, 3, 4), (8, 4, 1, 3),
(8, 4, 3, 1)]
temp = list(zip(*tuples))
tuples.sort(key=lambda x: temp[0].count(x[0])
,reverse=True)
print(tuples)
Run Code Online (Sandbox Code Playgroud)
但是,如果我现在尝试跳过创建"temp",即写下:
tuples = [(2, 1, 8, 4), (3, 4, 8, 1), (3, 8, 1, 4), (4, 1, 8, 3),
(4, 8, 1, 3), (8, 8, 3, 1), (8, 1, 3, 4), (8, 4, …Run Code Online (Sandbox Code Playgroud) 在ABC的pom我已经将属性定义为abc,其中ABC是模块.现在我想在ADF模块的pom中访问该属性.
<properties>
<A.B.C>${buildNumber}</A.B.C>
</properties>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>buildnumber</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<timestampFormat>{0,date,dd-MM-yyyy HH:mm:ss}</timestampFormat>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<revisiononscmfailure>
<!-- 71 Generate sequence build number based on: 72 build number and
timestamp 73 -->
<format>Build: #{0} ({1,date})</format>
<items>
<item>buildNumber\d*</item>
<item>timestamp</item>
</items>
</revisiononscmfailure>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我在$ ADF模块的pom中使用$ {ABC}作为版本的值.
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version>${A.B.C}</version>
<type>bundle</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
所以它给了我错误:bundle必须是有效的版本,但是$ {ABC}.
编辑:
或者我可以在某种程度上使用C模块的版本,因为我已经定义:
<version>${A.B.C}</version>
Run Code Online (Sandbox Code Playgroud)