小编Lab*_*bra的帖子

是否可以在SPARQL中的RDF集合中获取元素的位置?

假设我有以下Turtle声明:

@prefix : <http://example.org#> .

:ls :list (:a :b :c)
Run Code Online (Sandbox Code Playgroud)

有没有办法获得集合中元素的位置?

例如,使用此查询:

PREFIX :     <http://example.org#>
PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

SELECT ?elem WHERE {
 ?x :list ?ls .
 ?ls rdf:rest*/rdf:first ?elem .
}
Run Code Online (Sandbox Code Playgroud)

我明白了:

--------
| elem |
========
| :a   |
| :b   |
| :c   |
--------
Run Code Online (Sandbox Code Playgroud)

但我想要一个查询来获取:

--------------
| elem | pos |
==============
| :a   |  0  |
| :b   |  1  |
| :c   |  2  |
--------------
Run Code Online (Sandbox Code Playgroud)

可能吗?

rdf sparql

22
推荐指数
2
解决办法
3935
查看次数

如何在SBT中解决冲突的交叉版本后缀?

我有一个Play项目,它使用最近移植到Scala 2.11.1的库.

我还更新了Play to Scala 2.11.1.

当我尝试运行该项目时,我得到:

[error] Modules were resolved with conflicting cross-version suffixes in {file:/...}:
[error]    org.scalaz:scalaz-core _2.11, _2.10
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) Conflicting cross-version suffixes in: org.scalaz:scalaz-core
Run Code Online (Sandbox Code Playgroud)

我试图使用sbt-dependency-graph插件检测哪个是使用scalaz-core-2.10的库.但是,在依赖图树中,只有一个scalaz-core的外观:

info]   | +-org.scalaz:scalaz-core_2.11:7.0.6
Run Code Online (Sandbox Code Playgroud)

所以我不确定使用scalaz-core_2.10的库是哪个...如何检测它?

我在这里看到,一旦我发现它,我可以排除它,但我的问题是如何检测哪个是我必须排除的依赖.

scala dependency-management sbt playframework playframework-2.0

8
推荐指数
1
解决办法
3424
查看次数

未解决的依赖关系SBT org.scala-sbt#sbt_2.9.1; 0.12.1:未找到,播放示例

我试图在Play 2.0框架中运行示例,但是当我去运行"play"或"sbt"时.

当我进入目录"/ samples/scala/helloworld"时,我执行"sbt"并获得:

    [info] Loading project definition from C:\src\Play20\samples\scala\helloworld\project
[warn]  module not found: play#sbt-plugin;2.0
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== local: tried
[warn]   C:\Users\labra\.ivy2\local\play\sbt-plugin\scala_2.9.2\sbt_0.12\2.0\ivys\ivy.xml
[warn] ==== Typesafe repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-plugin;2.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes. …
Run Code Online (Sandbox Code Playgroud)

scala sbt playframework-2.0

7
推荐指数
1
解决办法
2万
查看次数

Eclipse Neon - 禁用欢迎屏幕

如何在Eclipse Neon中禁用欢迎屏幕?

尽管Eclipse Juno存在类似的问题,但建议的方法似乎在Eclipse Neon中不起作用.

我发现的一个问题是我有复选框:已always show Welcome at start up选中.如果我取消选中它并重新启动Eclipse Neon,它将再次被检查.

我去的时候会发生同样的行为Help->Welcome,似乎复选框无效.

我禁用欢迎屏幕的主要原因是,当显示欢迎屏幕时,我是否可以解决Ctrol-Arrows不能正常工作的问题.所以如果有另一个解决方案,我也会感激.

我也试图删除文件中的行-showsplash,Eclipse.ini但它似乎也没有工作.

我注意到只在使用Windows 7时才会出现问题.我尝试使用Windows 10,它似乎工作.所以,问题可能与Windows 7有关.

eclipse eclipse-neon

7
推荐指数
1
解决办法
5540
查看次数

在SPARQL中操作RDF集合的函数

我想知道是否有一些函数可以在SPARQL中操作RDF集合.

一个激励性问题如下.

假设你有:

@prefix : <http://example.org#> .
:x1 :value 3 .
:x2 :value 5 .
:x3 :value 6 .
:x4 :value 8 .

:list :values (:x1 :x2 :x3 :x4) .
Run Code Online (Sandbox Code Playgroud)

并且您想要计算以下公式:((Xn - Xn-1)+ ...(X2 - X1))/(N - 1)

有一些通用的方法来计算它吗?

到目前为止,我只能为一组固定的值计算它.例如,对于4个值,我可以使用以下查询:

prefix : <http://example.org#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?r { 
 ?list :values ?ls .
 ?ls rdf:first ?x1 .
 ?ls rdf:rest/rdf:first ?x2 .
 ?ls rdf:rest/rdf:rest/rdf:first ?x3 .
 ?ls rdf:rest/rdf:rest/rdf:rest/rdf:first ?x4 .
 ?x1 :value ?v1 .
 ?x2 :value ?v2 .
 ?x3 :value ?v3 …
Run Code Online (Sandbox Code Playgroud)

rdf sparql

4
推荐指数
1
解决办法
942
查看次数

如何在SPARQL中对值进行排名?

我想使用SPARQL创建观察排名.假设我有:

@prefix : <http://example.org#> .

:A :value 60 .
:B :value 23 .
:C :value 89 .
:D :value 34 .
Run Code Online (Sandbox Code Playgroud)

排名应该是:C = 1(最高),:A = 2,:D = 3,:B = 4.到目前为止,我能够使用以下查询解决它:

prefix : <http://example.org#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?x ?v ?ranking { 
 ?x :value ?v .
 { SELECT (GROUP_CONCAT(?x;separator="") as ?ordered) {
    { SELECT ?x {
       ?x :value ?v .
      } ORDER BY DESC(?v)
    }
   }
 }
 BIND (str(?x) as ?xName)
 BIND (strbefore(?ordered,?xName) as ?before) 
 BIND ((strlen(?before) / strlen(?xName)) + 1 …
Run Code Online (Sandbox Code Playgroud)

sparql

3
推荐指数
1
解决办法
805
查看次数

是否可以在SPARQL中表达递归定义?

想象一下,你有一个简单的社交网络,人们必须只有一个rdfs:label有价值的财产,"Person"并且任何数量的foaf:knows人也必须是具有相同结构的人.一些示例数据可能是:

:peter foaf:knows :john; 
       foaf:knows :anna;
       rdfs:label "Person" .

:john  foaf:knows :anna;
       rdfs:label "Person" .

:anna  rdfs:label "Person" .
Run Code Online (Sandbox Code Playgroud)

在逻辑术语中,定义可能类似于:

∀x(Person(x)≡rdfs:label(x,"Person")∧∀y(rdfs:label(x,y)→y ="Person")∧∀y(foaf:knows(x,y)→人(Y)))

是否可以在SPARQL中表达这些递归定义?

我能够表达部分查询而没有递归引用foaf:knowsas:

PREFIX ex: <http://xmlns.com/foaf/0.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>

select ?person {

    # Ensure there is only one rdfs:label
    { SELECT ?person {
      ?person rdfs:label ?o .
    } GROUP BY ?person HAVING (COUNT(*)=1)}

    # Ensure the rdfs:label value is "Person"
    { SELECT ?person {
      ?person rdfs:label ?o . 
      FILTER …
Run Code Online (Sandbox Code Playgroud)

recursion rdf constraints sparql

2
推荐指数
1
解决办法
1665
查看次数

在Scala中使用带有类型类的抽象类型

我想用一个抽象类型Value的限制属于类型类Show猫科动物.

我的第一次尝试将是这样的:

package examples
import cats._
import cats.data._
import cats.implicits._

class UsingShow1 {
  type Value <: Show[Value]  // Not sure if this declaration is right

  def showValues(vs: List[Value]): String = 
    vs.map(implicitly[Show[Value]].show(_)).mkString // Error line

}
Run Code Online (Sandbox Code Playgroud)

但是编译器没有找到隐含参数Show[Value].

我知道我可以将前面的例子定义为:

class UsingShow2[Value: Show] {
  def showValues(vs: List[Value]): String = 
    vs.map(implicitly[Show[Value]].show(_)).mkString
}
Run Code Online (Sandbox Code Playgroud)

但是,我想知道是否可以使用抽象类型而不是类型参数.

scala scala-cats

1
推荐指数
1
解决办法
274
查看次数