onProperty と someValueFrom で構成されるフクロウ ファイルからクラスのコンテンツを抽出しようとしています。someValueFrom は、unionOf (onProperty、someValueFrom、および equalClass) を含むクラスで構成されています。これらのデータを抽出する SPARQL クエリを作成しましたが、毎回「 :b0」や「 :b1」などの空白ノードを返します。必要な結果を提供するためにクエリをどうすればよいか、誰にもわかりません。これは私のフクロウファイルです:
<?xml version="1.0"?>
<rdf:RDF
xmlns="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:ns0="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#"
xml:base="http://owl.cs.manchester.ac.uk/2009/07/sssw/people">
<owl:Ontology rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people"/>
<owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"/>
<owl:Class rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#haulage_worker">
<rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
></rdfs:comment>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#works_for"/>
</owl:onProperty>
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#part_of"/>
</owl:onProperty>
<owl:someValuesFrom>
<owl:Class rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#haulage_company"/>
</owl:someValuesFrom>
</owl:Restriction>
<owl:Class rdf:about="http://owl.cs.manchester.ac.uk/2009/07/sssw/people#haulage_company"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>haulage worker</rdfs:label>
</owl:Class>
</rdf:RDF>
これは私が作成したSPARQLクエリです:
prefix abc: <http://owl.cs.manchester.ac.uk/2009/07/sssw/people#>
prefix ghi: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix mno: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix list: <http://jena.hpl.hp.com/ARQ/list#>
select distinct ?class ?ObjectProperty ?someValuesFrom ?otherClass where { ?class a owl:Class .
OPTIONAL{
?class owl:equivalentClass ?e .
?e a owl:Restriction .
# ?e owl:onProperty ?ObjectProperty .
?e owl:someValuesFrom [ a owl:Class;
owl:unionOf [ rdf:first ? ObjectProperty;
rdf:rest ?someValuesFrom ; rdf:rest*/rdf:first ?otherClass]] .
}
FILTER( STRSTARTS(STR(?class),STR(owl:)) || STRSTARTS(STR(?class),STR(abc:)))
}group by ?class ?ObjectProperty ?someValuesFrom ?otherClass
order by ?class
そしてこれは私が得た結果です:
-------------------------------------------------------------------------------
| class | ObjectProperty | someValuesFrom | otherClass |
===============================================================================
| abc:haulage_company | | | |
| abc:haulage_worker | _:b0 | _:b1 | _:b0 |
| abc:haulage_worker | _:b0 | _:b1 | abc:haulage_company |
| owl:Thing | | | |
-------------------------------------------------------------------------------
しかし、期待される結果は次のとおりです。
-----------------------------------------------------------------------------
| class | ObjectProperty | someValuesFrom | otherClass |
=============================================================================
| abc:haulage_company | | | |
| abc:haulage_worker | abc:works_for | | |
| abc:haulage_worker | abc:part_of | haulage_company | haulage_company |
| owl:Thing | | | |
-----------------------------------------------------------------------------
この結果を返すには、SPARQL クエリをどうすればよいですか?
よろしくお願いします:)