Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern-apply unexpected result (sesame backend) #3

Open
nevenavv opened this issue Jan 10, 2011 · 1 comment
Open

pattern-apply unexpected result (sesame backend) #3

nevenavv opened this issue Jan 10, 2011 · 1 comment

Comments

@nevenavv
Copy link

Here is example:
(def e (document-to-model "http://www.snee.com/rdf/elvisimp.rdf" :xml))
(def et (model-to-triples e))
(def elvez (make-pattern [[:?s :?p (l "El Vez")]]))
(def q (defquery
(query-set-type :select)
(query-set-vars [:?s :?p])
(query-set-pattern elvez)))

(query-triples e q)
=> ([[#<SesameResource http://members.aol.com/elvezco> #<SesameResource http://purl.org/dc/elements/1.1/title> #<SesameLiteral El Vez>]])
(model-pattern-apply e elvez) 
=> ([[#<SesameResource http://members.aol.com/elvezco> #<SesameResource http://purl.org/dc/elements/1.1/title> #<SesameLiteral El Vez>]])

;======= unexpected result =======
(pattern-apply et elvez) 
=> ()

Same with jena backed:

(query-triples e q)
=> (([#<JenaResource http://members.aol.com/elvezco> #<JenaResource http://purl.org/dc/elements/1.1/title> #<JenaLiteral El Vez>]))
(model-pattern-apply e elvez) 
=> (([#<JenaResource http://members.aol.com/elvezco> #<JenaResource http://purl.org/dc/elements/1.1/title> #<JenaLiteral El Vez>]))

;======= OK =======
(pattern-apply et elvez) 
=> (([#<JenaResource http://members.aol.com/elvezco> #<JenaResource http://purl.org/dc/elements/1.1/title> #<JenaLiteral El Vez>]))
@frenchy64
Copy link

This seems to be related to build-model or add-triples' behaviour.

pattern-apply calls model-query-triples directly, which seems to be where it starts to go pear shaped.

(def e (document-to-model "http://www.snee.com/rdf/elvisimp.rdf" :xml))
(def et (model-to-triples e))

(def quer (defquery
                 (query-set-pattern elvez)
                 (query-set-type :select)
                 (query-set-vars [:?s :?p])
                 (query-set-distinct)
                 (chain-limit nil)
                 (chain-offset nil)))

;; works fine if you start off with a model
(model-query e quer)
=> ([[#<SesameResource http://members.aol.com/elvezco> #<SesameResource  http://purl.org/dc/elements/1.1/title> #<SesameLiteral El Vez>]])

;; but if you create a model with defmodel and populate it with triples, like pattern-apply, it fails
(model-query-triples (defmodel (model-add-triples et)) quer)
=> ()

;; .. same ..
(def new-model (add-triples (build-model) et))
(model-query-triples new-model quer)
=> ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants