sparql - Unexpected result using LIMIT with CONSTRUCT -


something strange going on in construct query using limit. expect receive 1 or 2 solutions limit 1 , limit 2, respectively, i.e., 1 or 2 graphs, instead 2 graphs, either 11 or 12 triples.

construct {    ex:sceneresource skos:related ?newscenesubject.   ?newscenesubject lcx:scene ;                    dcterms:subject ?type ;                     lcx:hastitle ?title ;                    lcx:describedby ?thumbnail ;                    lcx:motto ?motto ;                    lcx:freebaseid ?freebaseid } {    { ?newscenesubject ex:interesttype1 }   union   { ?newscenesubject ex:interesttype2 }    ?newscenesubject lcx:hastitle ?title ;                    ?type .                    lcx:freebaseid ?freebaseid .   optional { ?newscenesubject lcx:motto ?motto  }   optional { ?newscenesubject lcx:describedby ?thumbnail } } limit 2 

have misunderstood limit construct, or there bug in jena api?

your question little unclear expecting , got attempt answer anyway.

the limit applies where portion of query, in specification there example of using limit construct , states following:

the output graph construct template formed 2 of solutions graph pattern matching

i.e. takes at most 2 rows where clause , feeds them construct template.

since template can generate potentially many triples actual maximum number of results limit multiplied number of triple patterns in template. since individual patterns in template may generate invalid triples (and these discarded per specification) actual number of triples may lower:

if such instantiation produces triple containing unbound variable or illegal rdf construct, such literal in subject or predicate position, triple not included in output rdf graph

so you've described , specification jena's behavior correct.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -