需要一个 sparql 查询来产生特定的输出

问题描述 投票:0回答:0

我有以下ttl文件:

@prefix : <http://example.org/ex#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/ex> .
@prefix ex: <http://example.org/ex#> .

ex:Producer a owl:Class .

ex:co-worker-of a owl:ObjectProperty ;
                rdfs:domain ex:Producer ;
                rdfs:range ex:Producer .

ex:firstname a owl:DatatypeProperty ;
             rdfs:domain ex:Producer ;
             rdfs:range xsd:string .

ex:lastname a owl:DatatypeProperty ;
             rdfs:domain ex:Producer ;
             rdfs:range xsd:string .

:AM a ex:Producer ;
    ex:firstname "John" ;
    ex:lastname: "Smith" ;
    ex:co-worker-of :AB.

:AB a ex:Producer ;
    ex:firstname "Peter" ;
    ex:lastname: "Jackson" ;
    ex:co-worker-of :AM .

:BL a ex:Producer ;
    ex:firstname "Mary" ;
    ex:lastname: "Wells" ;
    ex:co-worker-of :RS .

:RS a ex:Producer ;
    ex:firstname "Nina" ;
    ex:lastname: "Jones" ;
    ex:co-worker-of :BL .

我需要 sparql,它将产生以下输出:

实例1 名字1 姓氏1 实例2 名字2 姓氏2
上午 约翰 史密斯 AB 彼得 杰克逊
BL 玛丽 威尔斯 RS 妮娜 琼斯

感谢您的帮助。

sparql rdf ttl
© www.soinside.com 2019 - 2024. All rights reserved.