2016-05-14 9 views
-2

私は2つのwhere節を持っています。このクエリの論理エラーですか?

PREFIX tourister: <PREFIX_VALUE> 
SELECT ?a 
WHERE { 
    {?a tourister:hasRating ?b . 
    ?b ?c '5'@string } . 
    {?a tourister:hasFeature ?b . 
    ?b ?c 'Pool'@string } 
} 

自分の上で実行されたとき彼らは、正常に動作、またはそれらの間のUNION句がある場合は、しかし、私は交差点を探しています。私がオンラインで読んだことから、「.」を交差点として使用できることが判明しました。しかし、.では、結果は0です。いいえ、構文エラー、ロジックに問題があります。

また、上記クエリのPREFIX_VALUEはエラーではありませんので、意図的に省略しています。

<!-- http://tourister.space/ontologies/tourism#TESTInd --> 
 

 
    <owl:NamedIndividual rdf:about="http://tourister.space/ontologies/tourism#TESTInd"> 
 
     <rdf:type rdf:resource="http://tourister.space/ontologies/tourism#Hotel"/> 
 
     <hasFeature rdf:resource="http://tourister.space/ontologies/tourism#TESTIndFeature"/> 
 
     <hasRating rdf:resource="http://tourister.space/ontologies/tourism#TESTIndRating"/> 
 
    </owl:NamedIndividual> 
 
    
 

 

 
    <!-- http://tourister.space/ontologies/tourism#TESTIndFeature --> 
 

 
    <owl:NamedIndividual rdf:about="http://tourister.space/ontologies/tourism#TESTIndFeature"> 
 
     <rdf:type rdf:resource="http://tourister.space/ontologies/tourism#Feature"/> 
 
     <hasName xml:lang="string">Pool</hasName> 
 
    </owl:NamedIndividual> 
 
    
 

 

 
    <!-- http://tourister.space/ontologies/tourism#TESTIndRating --> 
 

 
    <owl:NamedIndividual rdf:about="http://tourister.space/ontologies/tourism#TESTIndRating"> 
 
     <rdf:type rdf:resource="http://tourister.space/ontologies/tourism#Rating"/> 
 
     <hasStarRating xml:lang="string">5</hasStarRating> 
 
    </owl:NamedIndividual>

+0

詳細が必要です。詳細については、http://stackoverflow.com/help/mcveを参照してください。 – AndyS

+0

より簡単なクエリを使用して内括弧を削除できないのはなぜですか?また、 'string 'ではなく、言語の値に適切な言語タグを使用するようにお勧めします。 – AKSW

+0

RDFも間違っています。 'xml:lang ="文字列 "' ??私はRDF/XMLを手書きではないことをお勧めします。人間が読めるものではありません。 – scotthenninger

答えて

0

データおよびクエリについては不明で多くの事。ここでは、より読みやすく、SPARQLに優しいタートルのテキストのシリアライズの代替方法があります。私はRatingFeatureクラスが必要であることは明確ではないとしても(彼らは可能性があり、かつ簡単に戻って追加することができます)、モデルを簡素化:

@prefix tourister: <http://example.org/ex#> . 

tourister:TESTInd 
    rdf:type tourister:Hotel ; 
    tourister:hasFeature "Pool"^^xsd:string ; 
    tourister:hasStarRating 5 . 
tourister:Hotel 
    rdf:type owl:Class ; 
    rdfs:subClassOf owl:Thing . 
tourister:hasFeature 
    rdf:type owl:DatatypeProperty ; 
    rdfs:range xsd:string . 
tourister:hasStarRating 
    rdf:type owl:DatatypeProperty ; 
    rdfs:range xsd:integer . 

このことから、それはSPARQLを見つけることと思われます5つ星の評価とプール付きのホテルはトリプルの最初のセットから、ほぼ直接取得されています

SELECT ?hotel 
WHERE { 
    ?hotel tourister:hasFeature "Pool"^^xsd:string ; 
      tourister:hasStarRating 5 . 
} 

ちょうどスタートだ、と私はRDFに宿題のビットを行うことをお勧めする最初ではありませんさらに進める前にSPARQLを参照してください。私はあなたがそのことについての短期的な質問よりも、始めるにあたってより生産的な道を見つけると思います。

関連する問題