LDFlex 按类型筛选

LDFlex filter by type

我想使用 LDFlex 列出特定类型文档中的所有主题。

data["https://example.com/mydocument.ttl"].subjects 提供文档中的所有主题。在 SPARQL 中可以指定类似 WHERE {?s a mytype} 的内容;我怎样才能在 LDFlex 中做到这一点?可能吗?

如果您在 JSON-LD 上下文中将 rdf:type 属性 映射为反向 属性(假设为 ofType),那么您可以执行以下操作:

data["https://example.com/mydocument.ttl"].ofType(namedNode(myType))

其中 myType 是类型的 URI。

此实现由 https://github.com/LDflex/LDflex/issues/40 添加,从 LDflex v2.8 开始可用。