I want to query records where not all records have all properties. Is it possible to get them with blank values by just using basic graph patterns in the query and without using optional?
相关问题
- Creating a SPARQL parameterized query using append
- Getting list of persons using SPARQL dbpedia
- How can I optimize a SPARQL query that returns opt
- Calculate the depth of subclass in the OWL ontolog
- How to get the terminal leaves of a Wikipedia root
相关文章
- The difference between blank nodes and variables i
- How to display alert box when no json value is giv
- How to turn a SPARQL/SPIN query/rule into an RDF s
- boundary for arbitrary property path in SPARQL 1.1
- sparql complete tree from subject
- Jena Fuseki assembler file + TDB + OWL reasoner
- How to get abstract and thumbnail of a Wikipedia a
- Saving and reusing the result of a SPARQL query
A variable has to be bound to some value in order for there to be a match. The exception is with optional. There you can get a match where it's optional for a particular pattern to have matched. If you want an optional variable for a match, you'll have to use optional.
Technically, you could avoid using optional by using a union with the different partial matchings that could occur. In that sense, you wouldn't be using optional, but it'd be even more complex:
You can achieve this by using a CONSTRUCT query. Use a CONSTRUCT with a simple BGP to retrieve the relevant subset of your complete dataset, and then post-process that result.
For example, imagine you have a set of records about persons, where there are names, e-mail addresses, phone numbers, but not necessarily all of these properties are filled out for every person.
You can then just do a query that retrieves all properties for resources of type
Person
. Here's an example in Java (using Sesame API):You now have a query result that contains all available person-data. Dealing with potentially missing values is now just a question of processing the result. For example: