54366

sparql and query in group of multiple predicates

Question:

I did not get the right sentence to ask the question. I would like to explain my problem using a sample data.

let's say the triples are as below.

@prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix xs: <http://www.w3.org/2001/XMLSchema#> . @prefix p0: <http://www.mlacustom.com#> . @prefix p2: <http://www.mla.com/term/> . _:bnode7021016689601753065 p0:lastModifiedDateTime "2018-09-14T12:55:38"^^<xsd:dateTime> ; p0:lastModifiedUser "admin"^^xs:string . <http://www.mla.com/name/4204078359> p0:hasClassingFacet "http://www.mla.com/facet/RA"^^xs:string ; p0:type "Normal"^^xs:string ; p0:classification _:bnode3452184423513029143 , _:bnode6827572371999795686 ; p0:recordType "Name"^^xs:string ; p0:recordNumber "4204078359"^^xs:string ; p0:stdDescriptor "classification111111"^^xs:string ; p0:establishedBy "admin"^^xs:string ; skos:prefLabel "classification111111"^^xs:string ; p0:createdBy "admin"^^xs:string ; a skos:Concept ; p0:createdDate "2018-09-14T12:55:38"^^<xsd:dateTime> ; p0:establishedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ; p0:hasRAsubFacet "http://www.mla.com/subfacet/classing-subject-authors"^^xs:string ; p0:lastModifiedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ; p0:lastModifiedDetails _:bnode7021016689601753065 ; p0:isProblematic "N,N"^^xs:string ; p0:lastModifiedBy "admin"^^xs:string ; p0:status "established"^^xs:string . _:bnode3452184423513029143 p0:literature p2:1513 ; p0:timePeriod p2:1005 ; p0:language p2:3199 . _:bnode6827572371999795686 p0:literature p2:11307 ; p0:timePeriod p2:1009 ; p0:language p2:31 .

please have a look at the p0:classification it has two blank nodes and both the blank nodes has triples with p0:literature, p0:timePeriod, p0:language

Now I want to write a SPARQL query where

( (p0:literature is p2:1513 AND p0:timePeriod is p2:1005) AND (p0:literature is p2:11307 AND p0:timePeriod is p2:1009) )

As per the above scenario it should return me the http://www.mla.com/name/4204078359 subject

Classification can have any number of blank nodes.

Answer1:

Here is one of the solutions. It is possible to find many different queries. This one is explicit.

SELECT ?s WHERE { ?s p0:classification ?o1 . ?s p0:classification ?o2 . ?o1 p0:literature p2:1513 ; p0:timePeriod p2:1005 . ?o2 p0:literature p2:11307 ; p0:timePeriod p2:1009 . }

Recommend

  • Microsoft Graph API Calendar API Null SeriesMasterId
  • Using unobtrusive JavaScript, parameter isn't null, but its values are
  • MongoDB: How to index unknown fields
  • How to get elements value with Linq To XML
  • gnuplot: Plot and fit 2d function with two variables
  • elasticsearch: term query fails
  • mysql AND clause on same column multiple times
  • Integer promotion unsigned in c++
  • Get all root sites listed in share point Admin center using graph api beta
  • Multiple Defered WHERE clause expressions in LINQ to SQL
  • Google Maps Geocoder: Return postal_code
  • Pass code to a method as an argument
  • Which list item is the most common
  • plot if col A has substring
  • sort decimal in php or mysql
  • Fetching statements from Learning Locker LRS using TinCan API
  • F# OleDb Syntax Error in INSERT INTO Statement Pulling Data from Access to Linked SQL Server
  • How to build PHP application with multiple language support (English, French, Chinese etc..)
  • calling non constexpr function from constexpr allowed in some conditions
  • Get-AzureRmAppServicePlan and Get-AzureRmWebApp return exceptions in Runbook
  • Full form of SKU in supportedRuntime in C#
  • rails - convert DateTime to UTC before saving to server
  • Filtering SPARQL results by day and month
  • How to intall Tomcat as a daemon on OS X?
  • How to call BeanFactoryPostProcessor.postProcessBeanFactory method when use Spring with XML configur
  • How to Compose OSGi Based project with C++ based project?
  • Cassandra: What is a subcolumn
  • How can I count unique terms in a plaintext file case-insensitively?
  • Why is django manage.py syncdb failing to create new columns on my development server?
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Configure nginx to return different files to different authenticated users with the same URI
  • How to override value that appears in a dropdown in the rails_admin gem
  • Image map in Flex
  • How to convert SOAP response with xsi values to json in WSO2esb
  • Jetty 9 HashLoginService
  • ActiveRecord query for a count of new users by day
  • Allowing both email and username for authentication
  • Illegal mix of collations for operation for date/time comparison
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I use threading to 'tick' a timer to be accessed by other threads?