SPARQL select query not working as expected

7 views
Skip to first unread message

Paul J. Albert

unread,
Feb 1, 2023, 3:41:47 PM2/1/23
to vivo...@googlegroups.com

Hi all,

 

I feel like A should be a subset of B, but it is not. (I’m attaching a screenshot of a formatted version so you can see I’m using these guys correctly: < >.) Any ideas? Thanks in advance.

 

 

A. This gets me 235 records...

 

PREFIX vivo: <http://vivoweb.org/ontology/core#>

PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#

PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#

PREFIX wcmc: http://weill.cornell.edu/vivo/ontology/wcmc#

 

SELECT  ?s ?o

WHERE

{

  graph http://vitro.mannlib.cornell.edu/a/graph/wcmcPublications {

    ?s http://vivoweb.org/ontology/core#relatedBy ?o .

    filter(regex(str(?s), https://vivo.med.cornell.edu/individual/cwid-joy2009))

    filter(regex(str(?o), "^https://vivo.med.cornell.edu/individual/pubid"))

  }

}

 

 

B. This downloads 224,390 records but only includes 9 of the above 235 records...

 

PREFIX vivo: http://vivoweb.org/ontology/core#

PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#

PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#

PREFIX wcmc: http://weill.cornell.edu/vivo/ontology/wcmc#

 

SELECT  ?s ?o

WHERE

{

  graph http://vitro.mannlib.cornell.edu/a/graph/wcmcPublications {

    ?s http://vivoweb.org/ontology/core#relatedBy ?o .

    filter(regex(str(?s), "^https://vivo.med.cornell.edu/individual/cwid-"))

    filter(regex(str(?o), "^https://vivo.med.cornell.edu/individual/pubid"))

  }

}

 

Thanks,

Paul

 

-- 

Paul Albert

Identity & Access Management Architect

 

Weill Cornell Medicine

 

Information Technologies & Services 
1300 York Avenue
New York, NY 10065

 

paa...@med.cornell.edu

 

 

Screen Shot 2023-02-01 at 3.36.27 PM.png
Reply all
Reply to author
Forward
0 new messages