检索有关sparqle端点的信息

xhv8bpkk  于 2021-07-11  发布在  Java
关注(0)|答案(0)|浏览(221)

我需要为一个项目复制一个类似https://sparqles.ai.wu.ac.at/discoverability . 问题是当我接近sparql端点的“可发现性”属性时。基于上面提到的网站,我可以从http调用中获得各种信息,比如void和服务描述,但我不知道如何获得这些信息。
他们说,我引用:
“可发现性实验搜索sparql内点本身索引的端点的无效元数据(必须明确提到端点;i、 例如,它不能仅仅是通用的void数据),在其已知的void位置或端点url所遵循的文档中
因此,基本上有几种方法来获取这些信息,区分这些方法是我的目标,建立一个类似的网页,在那里我可以根据我检索信息的方式设置绿点。
问题是我不太了解如何在http调用中检索这些信息。当我试图检索信息时,我得到了这样的结果(这个具体的例子来自http://dbpedia.org/sparql )

HTTP/1.1 200 OK
Date: Sun, 22 Nov 2020 09:33:31 GMT
Content-Type: application/rdf+xml; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Server: Virtuoso/07.20.3235 (Linux) x86_64-generic-linux-glibc25  VDB
Expires: Sun, 29 Nov 2020 09:33:31 GMT
Cache-Control: max-age=604800
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Depth,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
Content-Encoding: gzip

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:sd="http://www.w3.org/ns/sparql-service-description#" >
  <rdf:Description rdf:about="http://dbpedia.org/sparql">
    <rdf:type rdf:resource="http://www.w3.org/ns/sparql-service-description#Service" />
    <sd:endpoint rdf:resource="http://dbpedia.org/sparql" />
    <sd:feature rdf:resource="http://www.w3.org/ns/sparql-service-description#UnionDefaultGraph" />
    <sd:feature rdf:resource="http://www.w3.org/ns/sparql-service-description#DereferencesURIs" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_JSON" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_XML" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/Turtle" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/N-Triples" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/N3" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/RDF_XML" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_CSV" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/RDFa" />
    <sd:supportedLanguage rdf:resource="http://www.w3.org/ns/sparql-service-description#SPARQL10Query" />
    <sd:url rdf:resource="http://dbpedia.org/sparql" />
  </rdf:Description>
</rdf:RDF>

导师让我检查rdf xml drop中是否存在特定的字符串(我正在用java开发这个,this.url是sparql端点的url)

public boolean checkVoidDescription(String rdfDrop)
{
   return rdfDrop.contains( "<void:sparqlEndpoint rdf:resource=\""+this.url+"\" />");
}

public boolean checkServiceDescription(String rdfDrop)
{
    return rdfDrop.contains("<sd:url rdf:resource=\""+this.url+"\" />"); 
}

但是这些方法在大多数情况下都不起作用,例如,它们对http://data.allie.dbcls.jp/sparql

Date: Sun, 22 Nov 2020 09:50:13 GMT
Server: nginx/1.16.0
Content-Type: application/rdf+xml; charset=UTF-8
Content-Length: 3186
Accept-Ranges: bytes
Access-Control-Allow-Origin: *

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:sd="http://www.w3.org/ns/sparql-service-description#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:void="http://rdfs.org/ns/void#" >
  <rdf:Description rdf:about="http://data.allie.dbcls.jp/sparql">
    <rdf:type rdf:resource="http://www.w3.org/ns/sparql-service-description#Service" />
    <sd:endpoint rdf:resource="http://data.allie.dbcls.jp/sparql" />
    <sd:feature rdf:resource="http://www.w3.org/ns/sparql-service-description#UnionDefaultGraph" />
    <sd:feature rdf:resource="http://www.w3.org/ns/sparql-service-description#DereferencesURIs" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/N-Triples" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/N3" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/RDF_XML" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_CSV" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_JSON" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_XML" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/Turtle" />
    <sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/RDFa" />
    <sd:supportedLanguage rdf:resource="http://www.w3.org/ns/sparql-service-description#SPARQL11Query" />
    <sd:url rdf:resource="http://data.allie.dbcls.jp/sparql" />
    <sd:defaultDataset rdf:nodeID="b10011" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="b10009">
    <rdf:type rdf:resource="http://rdfs.org/ns/void#Dataset" />
    <rdf:type rdf:resource="http://www.w3.org/ns/sparql-service-description#Graph" />
    <foaf:homepage rdf:resource="http://purl.org/allie/" />
    <dcterms:title>Allie Abbreviation And Long Form Database in Life Science</dcterms:title>
    <void:vocabulary rdf:resource="http://www.w3.org/2002/07/owl#" />
    <void:vocabulary rdf:resource="http://purl.org/allie/ontology/201108#" />
    <dcterms:description>A database of abbreviations and long forms utilized in Lifesciences.</dcterms:description>
    <dcterms:publisher rdf:resource="http://dbcls.jp/" />
    <dcterms:license rdf:resource="http://creativecommons.org/licenses/by/2.1/jp/" />
    <void:dataDump rdf:resource="http://purl.org/allie/cgi-bin/getfile.cgi?file=allieRDF" />
    <void:exampleResource rdf:resource="http://purl.org/allie/id/longform/531855" />
    <void:sparqlEndpoint rdf:resource="http://data.allie.dbcls.jp/sparql" />
    <void:uriLookupEndpoint rdf:resource="http://data.allie.dbcls.jp/fct/" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="b10010">
    <rdf:type rdf:resource="http://www.w3.org/ns/sparql-service-description#NamedGraph" />
    <sd:name rdf:resource="http://purl.org/allie" />
    <sd:graph rdf:nodeID="b10009" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="b10011">
    <rdf:type rdf:resource="http://www.w3.org/ns/sparql-service-description#Dataset" />
    <sd:namedGraph rdf:nodeID="b10010" />
  </rdf:Description>
</rdf:RDF>

但他们不为你工作http://lod.b3kat.de/sparql (不能发布rdf+xml信息,字符太多,但是方法返回false,即使sparql端点的发现性表明http调用中存在void和服务描述)
因此,如果我不得不猜测,“字符串检查”方法不是正确的方法,但是我不太了解xml、rdf或sparql语法,我得到这个项目是因为应该是一个java项目。有人能给我一些建议吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题