sparql,jena , sparql to retreive the value of a min constraint


sparql to retreive the value of a min constraint

Question:

Tag: sparql,jena

How can I retreive a min constraint on a class' attribute using sparql? I have value min 1000 decimal, and I would like to get 1000

Thanks


Answer:

Here is the sparql query I used following Artemis' answer

SELECT ?min
WHERE {?s rdfs:subClassOf ?o.
       ?o owl:minQualifiedCardinality ?min. 
       FILTER(?s = :value) }

And with jena, I use getLiteral("min").getFloat();


Related:


querying RDFs using SPARQL query


sql,rdf,sparql,virtuoso
Assuming we have a dataset including the following 3 RDF triples. I want to retrieve all these three triples using sparql query. http://test.com/11/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0059714-INST http://test.com/23/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0059714-INST http://test.com/43/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0142817-INST Here is the query I wrote but I know it is not right: prefix pred:<http://test.com/> select distinct * where...

Loading owl file with Jena


java,jena,owl,ontology
I load several OWL files (RDF/XML serialization) with Jena as OntModel. For some files I get an error when reading them with ontoModel.read(): Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpMessage. I have org.apache.httpcore-sources.jar in the classpath. The file which currently poses problem is: ontologydesignpatterns.org/cp/owl/timeindexedpersonrole.owl I saved it with Protege as RDF/XML,...

Does Jena support enforcing OWL constraints during a SPARQL Update query?


sparql,jena,jena-rules
I'm trying to figure out if Jena (or any other SPARQL Update server) will enforce ontological constraints. For example, I want to enforce that only entities which have type x are allowed to have property y and the value of the property must have type z. I think this is...

MarkLogic 8 - SPARQL - Follow synonym chain


sparql,semantics,marklogic
Let's say I have lots of ontologies with synonyms. <term> <word>cat</word> <synonyms> <synonym>feline</synonym> </synonyms> </term> <term> <word>feline></word> <synonyms> <synonym>kitty</synonym> <synonyms> </term> How can I write a SPARQL query such that I can give it the word cat and it will give me all the synonyms of cat as well as...

Optimize SPARQL Query


sparql
I have query that finds similar tastes in movies. Such that the absolute value of difference between average rankings of users over same genre is less that 1: SELECT ?p ?p1 ?genre WHERE{ ?p movies:hasRated ?rate. ?p1 foaf:knows ?p. ?rate movies:ratedMovie ?mov. ?rate movies:hasRating ?rating. ?mov movies:hasGenre ?genre. ?p1 movies:hasRated...

Persisting data in Jena TDB triple store


rdf,jena,ontology,triplestore,tdb
I am using Jena TDB to persist RDF data. Before this I searched how to persist data in TDB and I came through the question at this link. Answer provided by Ryan clearly mentions the difference between various concepts, and one of the point I got about datasets is: "A...

setting soft limit for 4store client


sparql,4store
While running the sparql queries I get the warning # hit complexity limit 20 times, increasing soft limit may give more results and this is not dependent to any particular query but for all.I wanted to know how can I increase the soft limit if I am not using the...

How to get a single name for multiple name properties in DBPedia with SPARQL?


sparql,owl,dbpedia
I need to get persons' names from DBPedia, but the problem is that not every person has the dbpprop:fullname property, sometimes it only has the dbpprop:name or the rdfs:label property. To clarify: I want to query for the name with a preference for the first property, if that doesn't exist...

SPARQL: selecting people by country


sparql,dbpedia
toI am trying to select all people born in some country (e.g. Portugal) from DBPedia. I could use such request SELECT DISTINCT ?person WHERE { ?person dbpedia-owl:birthPlace dbpedia:Portugal. } But the problem is that not all people has dbpedia:Portugal as birthPlace. About 30% of people has just a town name...

What is the difference between a temporal and a non-temporal query


sql,database,sparql
I have read some resources that talk about temporal and non-temporal queries, specifically with SPARQL. What is the difference between these two kinds of queries?

SPARQL subquery in DBpedia


sparql,dbpedia
I want to filter a resource that is used as "join" in the query. For example, given a DBpedia resource, i need to return the label of resources linked by sameAs property and has "pt" in its URI. I am using the following query: SELECT ?label { <http://dbpedia.org/resource/Category:Algorithms> owl:sameAs ?nomePT....

Virtuoso 37000 Error SP030


sparql,semantics,semantic-web,virtuoso
why is showing this error, i see in the sparql query is correct, i don't see any mistake in prefix. PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX type: <http://dbpedia.org/class/yago/> PREFIX prop: <http://dbpedia.org/property/> SELECT ?country_name ?population WHERE { ?country rdf:type dbpedia-owl:Country; rdfs:label ?country_name ; prop:populationEstimate ?population . FILTER (?population > 2334456) . FILTER ( lang(?country_name)...

how to read SPARQL query and pass via $http.get


angularjs,sparql
I am trying to get some data from land registry API (http://landregistry.data.gov.uk/app/hpi/qonsole) and it uses SPARQL query. I am new to sparql queries and not sure what to pass in my param.query object and how to pass prefixes required. //myCode var req = { method: 'GET', url: 'http://landregistry.data.gov.uk/landregistry/query', headers: {...

SPARQL: How do I List and count each data type in an RDF dataset?


types,count,sparql
I am trying to count the instances of each datatype in a dataset. It is a simple dataset with only three data types: integer, string and dateTime. I can get the number of datatypes (3) by querying: SELECT (COUNT(DISTINCT datatype(?o)) AS ?dTypeCount) {?s ?p ?o. FILTER (isLiteral(?o)) } GROUP BY...

select the negative of a SPARQL query


sparql
Is possible to select the "negative" of a sparql query? For instance, consider the following RDF data, query and desired result: knowledge base: @prefix gr:<http://purl.org/goodrelations/v1#>. @prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>. :prod_A :hasProp :propA. :prod_B :hasProp :propB. :propB rdfs:label "Hello". :prod_C :hasProp :propC. :prod_D :hasProp :propD. Imaginary Query: PREFIX gr:<http://purl.org/goodrelations/v1#> SELECT ?prod WHERE {...

Filter SELECT output by string in Spaql


filter,sparql
I have a Sparql query like this : PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX hrdata:<http://www.hrdata.com/ontologies/hrdata.owl#> SELECT ?tableName2 ?fieldName ?primaryKey1 ?primaryKey2 ?tableName1 WHERE { ?tableName1 hrdata:hasField hrdata:EFFDT. ?fieldName hrdata:relatedField hrdata:EFFDT. ?tableName2 hrdata:hasField ?fieldName....

Sparql query not showing results


rdf,sparql,jena,owl,ontology
I have an ontology (dgo.owl) and a simple program (SparqlQuery.java) to query the same ontology. On running the query I do not get any results. After debugging for a long time I thought it would be good to put it in the community. The query script is as: OntModel ontmodque...

Ontologies, OWL, Sparql: Modelling that “something is not there” and performance considerations


performance,sparql,modeling,ontology,sesame
we want to model that "something is not there" as opposed to missing information, e.g. an explicit statement that "a patient did not get chemotherapy" or that "a patient does not have dyspnea" is different from missing information about whether a patient has dyspnea. We thought about several approaches, e.g....

URLError with SPARQLWrapper at sparql.query().convert()


python,sparql,ipython-notebook,fuseki,sparqlwrapper
I try a small python script to test my SPARQL request. However, just the next simple code doesn't work. from SPARQLWrapper import SPARQLWrapper, JSON import rdflib #connect to the sparql point sparql = SPARQLWrapper("http://localhost:3030/sparql") #SPARQL request sparql.setQuery(""" PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX...

How can I retrieve a list of specific person names from DBPedia by using SPARQL query in R


r,iteration,sparql,dbpedia
I am currently using the SPARQL package in R to query DBPedia and get the information for a list of specific person names. But I only know how to query one person or the "person category", such as query= "SELECT *{ dbpedia:Veit_Dietrich ?p ?o }" qd=SPARQL(endpoint,query) df=qd$results Is there anyway...

Is it possible to Filter Graphs in a way that they at most contain requested Data?


sparql
Let me start with an example query to explain my problem: SELECT ?g ?s ?p ?o WHERE { {GRAPH ?g { ?s ?p ?o. OPTIONAL{ ?s ab:temperature ?temperature.} FILTER (?temperature = 20) FILTER NOT EXISTS {?s ab:person ?person} } } } This query gives me all graphs (in this case...

Sparql query to get all classes that are subclass of a “property class”


sparql,semantic-web,owl,protege
I need to "annotate" some classes by adding a property to them. I need to do that in order to let the view layer of my application extract the correct classes. What I have done is: create an object property called uiProperty and edit these classes to make them subclass...

Count resources having a property of a certain type in SPARQL


rdf,sparql
I have data in a triple store and would like to compute the following: how many resources 'x' have the object property 'op' with at least 2 different resources 'r' of similar type 'R' as values? here is a example of such data in turtle syntax: PREFIX ex: <http://example.com> ex:doc1...

Simple SPARQL query on dbpedia results doesn't match expectations


sparql,dbpedia
I am struggling with the following SPARQL query executed via at DBpedia's SPARQL endpoint: select (count(?abstract) as ?count) where { <http://dbpedia.org/resource/Linked_Data> dbpedia-owl:abstract ?abstract . } SPARQL seems pretty simple and when I look at the linked data page, it appears that expected result would be 9. But the actual response...

Why does STRAFTER return blank data in json binding in angular?


json,string,sparql
I am using angular to bind the results of a SPARQL query. It works nicely until I attempt to bind data returned from queries using the SPARQL "STRAFTER" or "REPLACE" functions (code below) which returns blank data in $scope. But the same query works fine if I run it directly...

Storing separately individuals and ontology in sesame store


sparql,semantic-web,sesame
I have an ontology that I imported in a sesame repository. I want to add individuals for the classes that are defined in my ontology. Is it possible to add the individuals into another repository and not in the one that has stored the ontology? If this is possible how...

sparql to retreive the value of a min constraint


sparql,jena
How can I retreive a min constraint on a class' attribute using sparql? I have value min 1000 decimal, and I would like to get 1000 Thanks...

How to retrieve person names from DBPedia in different language versions?


r,sparql,dbpedia
I am currently querying DBPedia for a list of person names by using the SPARQL package in R. I noticed that when I use SPARQL query for English DBPedia like this: endpoint = "http://live.dbpedia.org/sparql" query= "SELECT *{ dbpedia:Veit_Dietrich ?p ?o }" qd=SPARQL(endpoint,query) df=qd$results Everything is fine, but if I want...

Compare average - SPARQL


sparql
There is a dataset of users ranking movies. Need to find the users with similar taste to user1. Similar taste defined as follows: consider the average rank for genre from user1 as avgr1 and for the same genre from user2 as avgr2, then user1 and user2 have similar taste is...

Counting numbers of DBpedia wikilink and external link using SPARQL


r,sparql,dbpedia,linked-data
I am currently querying DBPedia for a list of person names by using the SPARQL package in R. And now I am working on counting of different categories for one person, such as the number of wikilink or external_link. But I only know to count all the items together per...

MarkLogic 8 - Node.js Client API - Can I do a SPARQL Query?


node.js,sparql,marklogic
As the title says, I want to know if I can do a SPARQL query in the node.js client API or if I need to use the Server Side Javascript API.

SPARQL Group-Concat not working


rdf,sparql,jena
I've got an RDF graph element looking like this using Android & Jena: <ns0:CalendarItem rdf:about="http://my.url.com/ontologies/mash-up#CalendarItem-uh0cjvnuehhvfjpgppiggmpjac"> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-2de52a85-3107-4d82-a361-cca11afabdc8" /> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-3b0e0333-5693-43e7-bb6e-af06f7df9b12" /> <ns0:attendee...

Can SPARQL handle blank results for specific cells?


web-scraping,sparql,scrape,dbpedia
I am writing a SPARQL query and cant figure out how to allow blank results for specific columns. My current request is: select * where { ?game a dbpedia-owl:Game ; dbpprop:name ?name ; dbpedia-owl:publisher ?publisher . } Some Games have an owl for publisher while others do not. The above...

How to use the ASK WHERE statement with multiple conditions (sparql)


sparql,freebase
I want to check if an entity has one of the types listed below. If it does then the query must return true. PREFIX basekb:<http://rdf.basekb.com/ns/> basekb:music.release_track basekb:book.written_work basekb:book.book basekb:music.release basekb:music.album basekb:tv.tv_series.episode basekb:music.composition basekb:music.recording basekb:film.film basekb:fictional_universe.fictional_character Entity m.0109yb6 has the following types. The sparql query should return true http://rdf.basekb.com/ns/common.topic...

multiple users accessing RDF file for read and write


apache,rdf,jena,rdfs
I am using an RDF file to store links (URLs) of online resources that are added by different users about various topics. I am using Jena API to read and write the RDF file, on Apache server. My concern is that multiple users would allowed at the same time to...

Consequence of restrictions in ontology on SPARQL end results


rdf,sparql,semantics,owl,ontology
I am concerned about two classes (SensingDevice and Property) of my ontology (dgo.owl) as shown in the below figure. These two classes are connected by observes property: and the related ontology portion is as: <owl:Class rdf:about="http://www.iiitd.edu.in/~haroonr/ontologies/DGO#TemperatureSensor_Livingroom"> <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#SensingDevice"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observes"/>...

Unexpected End of Stream while trying to tokenise sparql query


rdf,sparql,xml-namespaces
i have this my rdf file and i try to get all triples from specific namespace 'ns1' <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ns1="http://www.w3.org/TR/rdf-schema/#" xmlns:property="http://www.SyrianDNA.com/property#" xmlns:info="http://www.SyrianDNA.com/info#"> <rdf:Description rdf:about="http://www.SyrianDNA.com/resource/monuments"> <ns1:be rdf:resource="http://www.SyrianDNA.com/resource/Syria"/>...

RDF SPARQL query multiple types


java,rdf,sparql
I am trying to parse a rdf graph using SPARQL. Naturally in a graph my entities can be more than one type at a time. How does a SPARQL query have to look like so that I can check for both types? How my graph looks like: <ns0:TrainArrival rdf:about="http://my.url.com/ontologies/mash-up#TrainArrival-7a60055b-1e7f-464d-b42e-b1839d623b69"> <ns0:arrivalTime...

SPARQL: Unresolved prefixed name: dbpprop:author


java,sparql,dbpedia
I'm running this query. It works fine on DBpedia (http://dbpedia.org/sparql), but it doesn't work in my Java code: PREFIX res: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?book WHERE { ?book a dbpedia-owl:Book . ?book dbpprop:author ?author . ?author dbpprop:name ?name FILTER regex(?name, "Agatha Christie", "i") } Infact, as stated by the...

How to add dot '.' in the name of individuals in Sparql?


sparql
Is it possible to have . (dot) in the name of the individuals? Something like this? SELECT ?tableName ?fieldName WHERE { ?fieldName hrdata:relatedField hrdata:ps_ti0002.EMPLID. } The dot in ps_ti0002.EMPLID is problematic....

sparql insert with where clause


curl,sparql,4store
How to insert insert query with "where" condition in 4store sparql As far as I have searched I got to know that we have to use curl command for the same.I tried using this Process p = Runtime.getRuntime().exec(new String[]{"bash","-c","curl -i -d 'update=INSERT+DATA+{+?subject2+<http://www.w3.org/2002/07/owl/sameAs>+?subject3+.+}+WHERE+{+?subject2+<http://localhost:2020/vocab/Schema_feature>+\""+first[0]+"\"+.+?subject3+<http://localhost:2020/vocab/Schema_feature>+\""+first[1]+"\"+.+}' http://localhost:8000/update/"});...

Query multiple models within same Dataset in TDB Jena


rdf,sparql,jena,ontology,tdb
I have an ontology (say dgo.owl) and another file containing individuals for same ontology stored in rdf format. I have stored both (ontology and instances/individual file) files in TDB under different named models (say dgo_ont and homedata). Now, I want to fire different SPARQL queries on a combination of these...

How to get all nouns in a certain language from Wiktionary using SPARQL


sparql,wiktionary
I'm trying to query Wiktionary with SPARQL to get all the terms that are nouns of a certain language (for example German) and as output: the string of the noun the grammatical gender (genus): male, female, neutral I am using the SPARQL-Endpoint: http://wiktionary.dbpedia.org/sparql and I found an example but I...

How to do a count and select variables in Sparql


sparql
Is there a way to select variables and get a count of the total variables in one Sparql query ? I want to return ?s and get a count of all the ?s matches I tried variations of the query below but I keep getting errors SELECT (COUNT(*) as ?cnt)...

Get position of item in rdf type sequence with sparql


sequence,rdf,sparql
i have a sequence encoded like this in rdf: _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq>. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_0> uri:a. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> uri:b. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> uri:c. now i want to have the position of a given uri within this list. is there something like: SELECT ?position WHERE { _:blanknode...