这是我正在运行的查询,用于获取所有编程语言的这些详细信息。每种编程语言都会影响其他语言或受其他语言影响。因此,可能有许多语言受其影响或受其影响。现在,概率在打印时将其所有值分别打印在行中。您可以查看图片。我希望所有其影响或影响力的编程语言都在同一行中。查询在下面。
SELECT ?pl ?abstract ?influenced ?influencedBy
WHERE {
?pl dbo:abstract ?abstract .
?pl dbo:influenced ?influenced .
?pl dbo:influencedBy ?influencedBy .
?pl rdf:type dbo:ProgrammingLanguage .
FILTER (LANG(?abstract) = 'en') .
}
我的结果的屏幕截图
您会看到此语言有两个影响力dBy值,并且将它们打印在单独的行中。
网站数据示例
答案 0 :(得分:0)
就像@AKSW所说的,类似-
SELECT ?pl
?abstract
( group_concat ( ?_influenced; separator="; " ) AS ?influenced )
( group_concat ( ?_influencedBy; separator="; " ) AS ?influencedBy )
WHERE
{ ?pl dbo:abstract ?abstract .
?pl dbo:influenced ?_influenced .
?pl dbo:influencedBy ?_influencedBy .
?pl rdf:type dbo:ProgrammingLanguage .
FILTER ( LANG ( ?abstract ) = 'en' ) .
}
GROUP BY ?pl ?abstract
要获取 ?pl_label
(我猜是 ?_influenced_label
和 ?_influencedBy_label
)您现在说自己想要,您将需要(和/或想要)稍微调整一下内容...
SELECT ?pl
?pl_label
( group_concat ( DISTINCT ?_influenced_label; separator="; " ) AS ?influenced )
( group_concat ( DISTINCT ?_influencedBy_label; separator="; " ) AS ?influencedBy )
?abstract
WHERE
{ ?pl rdf:type dbo:ProgrammingLanguage .
?pl dbo:abstract ?abstract .
FILTER ( LANG ( ?abstract ) = 'en' )
?pl rdfs:label ?pl_label
FILTER ( LANG ( ?pl_label ) = 'en' ) .
?pl dbo:influenced ?_influenced .
?_influenced rdfs:label ?_influenced_label
FILTER ( LANG ( ?_influenced_label ) = 'en' ) .
?pl dbo:influencedBy ?_influencedBy .
?_influencedBy rdfs:label ?_influencedBy_label
FILTER ( LANG ( ?_influencedBy_label ) = 'en' ) .
}
GROUP BY ?pl ?pl_label ?abstract