blank-nodes

What are values starting with “t” and how to ignore them for counting

牧云@^-^@ 提交于 2019-12-22 18:36:45
问题 I am trying to query the frequency of certain attributes in Wikidata, using SPARQL. For example, to find out what the frequency of different values for gender is, I have the following query: SELECT ?rid (COUNT(?rid) AS ?count) WHERE { ?qid wdt:P21 ?rid. BIND(wd:Q5 AS ?human) ?qid wdt:P31 ?human. } GROUP BY ?rid I get the following result: wd:Q6581097 2752163 wd:Q6581072 562339 wd:Q1052281 223 wd:Q1097630 68 wd:Q2449503 67 wd:Q48270 36 wd:Q44148 8 wd:Q43445 4 t152990852 1 t152990762 1

Sparql query with Blank node can be complex

情到浓时终转凉″ 提交于 2019-12-21 12:41:21
问题 I read this blog article, Problems of the RDF model: Blank Nodes, and there's mentioned that using blank nodes can complicate the handling of data. Can you give me an example why using blank nodes is difficult to perform a SPARQL query? I do not understand the complexity of blank nodes. Can you explain me the meaning and semantics of an existential variable? I do not understand clearly this explanation given in the RDF Semantics Recommendation, 1.5. Blank Nodes as Existential Variables. 回答1:

Excluding Blank Nodes from SPARQL query results

安稳与你 提交于 2019-12-21 02:35:13
问题 I am using RDFLib to query on the Semantic Dicom Ontology. I am querying for owl:Class in the graph constructed from the above ontology. RDFLib returns results which contain blank nodes and I wish to exclude such queries. My query - from rdflib import Graph g = Graph() g.parse('dicom.owl') q = """SELECT ?c WHERE {?c rdf:type owl:Class}""" qres = g.query(q) dicom.owl is the Semantic Dicom Ontology downloaded in my machine. Some of the results that I receive - How can I modify my query to

JSON-LD blank node to nested object in Apache Jena

送分小仙女□ 提交于 2019-12-19 21:54:35
问题 I have the following example Turtle document: @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix example: <http://example.com/vocabulary/> . @prefix dcat: <http://www.w3.org/ns/dcat#> . <http://example.com/datasets/1> a dcat:Distribution ; example:props [ example:prop1 "hello" ; example:prop2 "1" ] ; dct:description "test data" . I converted it into JSON-LD with the Apache Jena (RDFDataMgr with JSONLD_COMPACT_PRETTY) to JSON-LD: { "

Protege 4 - Saving RDF reformats nested blank nodes

为君一笑 提交于 2019-12-11 19:22:16
问题 I just switched from TopBraid to try out Protege. I have an ontology with some RDF that resembles this: instances:some_thing1 a semapi:SomeClass ; semapi:hasChainTo ( [ a semapi:SomeOtherClass ; semapi:hasChainTo ( [ ... ] [ ... ] ) ] ) . The idea is that this nested blank nodes syntax works great because the chains get very deep and this syntax is fluid and highly readable and maintainable as the chains may change from time to time and new chains can be added. Not only that, but I have

SPARQL update with optional parts

喜你入骨 提交于 2019-12-11 12:07:59
问题 Consider the following SPARQL update: INSERT { ?performance mo:performer ?performer ; # optional mo:singer ?singer ; # optional mo:performance_of [ dc:title ?title ; # mandatory mo:composed_in [ a mo:Composition ; mo:composer ?composer # optional ] ] } WHERE {} If I do not provide values (e.g. in Jena's ParameterizedSparqlString.setIri() for ?performer , ?singer , or ?composer , this update won't insert statements with the corresponding objects, which is as intended. But how can I suppress []

How to distinguish between two Blank Nodes in RDF?

梦想与她 提交于 2019-12-11 07:12:57
问题 I am having difficulty understanding a passage from w3.org. The confusing passage may be an error, or I may just be confused. The following is Section 6.6 of the RDF Concepts Specification, 6.6 Blank Nodes The blank nodes in an RDF graph are drawn from an infinite set. This set of blank nodes, the set of all RDF URI references and the set of all literals are pairwise disjoint. Otherwise, this set of blank nodes is arbitrary. RDF makes no reference to any internal structure of blank nodes.

Delete blank node from ontology through SPARQL UPDATE

北战南征 提交于 2019-12-11 01:48:35
问题 I am storing some data in my ontology model made in protege with help of a SPARQL UPDATE 'insert' operation. Below is the update query. PREFIX test: <http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#> insert { [] test:Kpi_Variable ?s ; test:hasValue_ROB4 ?p ; test:hasTime ?now . } where { values (?s ?p) { (test:Actual_Production_Time 33) } bind (now() as ?now) } It stores in the rdf graph in the following way: [ test:Kpi_Variable test:Actual_Production_Time ; test

How to recursively expand blank nodes in SPARQL construct query?

雨燕双飞 提交于 2019-12-09 14:57:36
问题 There is probably an easy to answer to this, but I can't even figure out how to formulate the Google query to find it. I'm writing SPARQL construct queries against a dataset that includes blank nodes. So if I do a query like CONSTRUCT {?x ?y ?z .} WHERE {?x ?y ?z .} Then one of my results might be: nm:John nm:owns _:Node Which is a problem if all of the _:Node nm:has nm:Hats triples don't also get into the query result somehow (because some parsers I'm using like rdflib for Python really don

What are values starting with “t” and how to ignore them for counting

喜你入骨 提交于 2019-12-06 15:09:39
I am trying to query the frequency of certain attributes in Wikidata , using SPARQL. For example, to find out what the frequency of different values for gender is, I have the following query: SELECT ?rid (COUNT(?rid) AS ?count) WHERE { ?qid wdt:P21 ?rid. BIND(wd:Q5 AS ?human) ?qid wdt:P31 ?human. } GROUP BY ?rid I get the following result: wd:Q6581097 2752163 wd:Q6581072 562339 wd:Q1052281 223 wd:Q1097630 68 wd:Q2449503 67 wd:Q48270 36 wd:Q44148 8 wd:Q43445 4 t152990852 1 t152990762 1 t152990752 1 t152990635 1 t152775383 1 t152775370 1 t152775368 1 ... I have the following questions regarding