Sparql Import Freebase to Triplestore

I'm currently planning a big project containing big data. I already used the search and all results tell me that it's not possible to import Freebase into any triplestore without usage of 3rd Party Tools like BaseKB or Freebase to RDF As I can see, the dump is already available as RDF, so where is the problem if I want to import the dump into my 4store triplestore and access the data via SPARQL?

SPARQL DELETE in 4store

I'm trying to delete a few triples from my triple store but, unfortunately, I can't even get this simple query to work: WITH <GRAPH> DELETE { ?s ?p ?o . } WHERE { <URI> <PREDICATE> ?s . ?s ?p ?o . } I just want to delete all triples that belong to a subject which is itself connected to the URI I have (with the predicate I have). The WHERE statement in a SELECT query gives me all the solutions that I want to be deleted. EDIT Ok, so I kept playing around with it, and

Using LIMIT in sparql update?

I need to modify triples in a very large repository, so to avoid memory issues I want to do a basic sparql update but split it up into chunks. DELETE { ?s predi:cate ?o } INSERT { ?s predi:cate <http://whatever> } WHERE { ?s predi:cate ?context} LIMIT 100 is what I would like to do, but I get a sparql syntax error with the limit so I'm assuming that wont work. Is a sub query the only way? I was able to get a little further by doing something like: DELETE { ?s predi:cate ?o } INSERT {

Sparql How to return an union of entity id's

Consider having a list of persons(parent) and their posts(children). Note that I have simplified the example but it could be parent-child-childofChild-etc, so some entities with a tree of children. I would like to have a query that returns a union of some filtered(on some criteria) persons id's and their post id's like so: person1Id person2Id person1Post1Id person1Post2Id ....... Given a concrete situation with 3 persons(with properties age,name) where Person1 has 2 posts and the other pers

SPARQL Get all the properties from a Class or an Individual

What I want to do is to get the property list from the Individual1 or from a class, Get all properties from "something" The result should be something like this (for Secret_Data): | Asset_has_Confidentiality_Importance | High | | Asset_has_Availability_Importance....| Moderate | | Asset_has_Integrity_Importance.......| Moderate | | Asset_threatenedBy_ThreatEvent.......| Compromise_sensitive

Sparql How to resolve the execution limits in Linkedmdb

I was trying to extract all movies from Linkedmdb. I used OFFSET to make sure I wont hit the maximum number of results per query. I used the following scrip in python """ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX movie: <http://data.linkedmdb.org/resource/movie/> SELECT distinct ?film WHERE { ?film a movie:film . } LIMIT 1000 OFFSET %s """ %i I looped 5 times, with offsets being 0,1000,2000,3000,4000 and recorded the number of results. It was (1000,1000,500

Sparql Query multiple TDB Datasets

Using: jena-fuseki-1.1.0, apache-jena-2.12.0 What I want to achieve and my current state: I am trying to set up a local jena-fuseki server with the dbpedia Persondata (English and German), Inter-Language Links, Images and Links to Wikipedia Article downloaded from wiki.dbpedia.org/Downloads2014 as .nt files. I want to run the SPAQRL-Query below on them and get the same result as from dbpedia.org/sparql. This Query should give me all living Persons born in Stuttgart,Germany with their name, bi

Adding more information on a simple SPARQL query

I've been running some examples with SPARQL, and it looks pretty cool. I'm using for the moment http://dbpedia.org/snorql I'm trying to query Salty Desserts over there. I can list Desserts using SELECT ?food WHERE { ?food rdf:type <http://dbpedia.org/class/yago/Desserts> } ORDER BY ?name How do I actually put on the query that the food has to be salty? Sorry if this seems to be a dumb question.

SPARQL distinct rowcount not returning correct number

I have the following SPARQL query , please pay attention to the rowcount in the selection predicate and the group by clause at the end of the query. I want the query to return the correct row count in every record , I noticed that the row count that is being returned is not correct meaning if there is a single record I get 1 or sometimes 2 and if there are more than 2 records , I still get a 2, basically it seems to return random value. I know its because of some issue with my query , can some

Sparql Wikidata - Is this query possible?

I want to do a query on WikiData where I get all items, that are somehow connect to another item. For example I have Item "Vienna" (Q1741). Now I want to get all Items, that have Item Vienna in any property. The API I currently use is the one from wmflabs. Here I can do a query like claim[189:1741] This gives me every item with property "Place of discovery" (P189) = "Vienna" (Q1741). But what I want is something like claim[*:1741] to get all items where any property fits "Vienna", for

Dbpedia/sparql: get population & lat/lng of all cities/towns/villages in UK

I'm entering the following query at http://dbpedia.org/sparql: PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT ?s ?name ?value ?lat ?lng WHERE { ?s a <http://dbpedia.org/ontology/PopulatedPlace> . ?s <http://dbpedia.org/property/name> ?name . ?s <http://dbpedia.org/property/populationTotal> ?value . FILTER (?lng > -8.64 AND ?lng < 2.1 AND ?lat < 61.1 AND ?lat > 49.35 ) ?s geo:lat ?lat . ?s geo:long ?lng . } (The bound

Weird behaviour of bif:st_intersects in virtuoso sparql

Using the latest stable release: Virtuoso version 07.20.3215 on Linux (x86_64-unknown-linux-gnu). My initial SPARQL query on a custom N3 serialized RDF dataset is: select (?s as ?addr), ?geo, (bif:st_distance (?geo, bif:st_point(51.3, 12.3)) as ?dist) where { ?s <http://www.opengis.net/ont/geosparql#asWKT> ?geo . ?s <http://location/class> "place" . ?s <http://location/type> "house" . } and it gives desired result: <table class="sparql" border=

What is the scope of "values" in SPARQL query graph

I have a query that includes many subqueries, which also include some subqueries. I want to know the scope of the values clause in a SPARQL query. Does it go down to the subqueries as well? If I defined a values clause in the subquery, and used the same variable in a father query, will that variable have just the values specified in the son query? (what about vice versa?) I looked at the SPARQL 1.1 spec, but all I found is the following, which doesn't appear to answer my question: A VALUES

Sparql query for RDF and mutilple attribute values

hi i want to write a query for : <car name="BMW"> <attribute =speed=""> <value>1.5</value> </attribute> <attribute =weight=""> <value>30</value> </attribute> </car> i want the output in the format : BMW has speed 1.5 and weight 30. i have converted the above into RDF but i cant get my desired results. any help? hi my actual data is from XML file , and i converted into RDF: i created this ontology: @prefix veh: <ht

Sparql Fuseki owl reasoner not working with TDB

This is my configuration file # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 ## Fuseki Server configuration file. @prefix : <#> . @prefix fuseki: <http://jena.apache.org/fuseki#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . [] r

Sparql How can I build a RDF graph about some individuals with a single CONSTRUCT?

I have a construct query in SPARQL which is useful to retrieve details about contracts: CONSTRUCT { ?contract dcterm:identifier ?id . ?contract rdfs:label ?label . ?contract pc:bidder ?bidder . } WHERE { OPTIONAL { ?contract dcterm:identifier ?id . } OPTIONAL { ?contract rdfs:label ?label . } OPTIONAL { ?contract pc:tender ?tender . ?tender pc:bidder ?bidder . } } I have a list of contracts, for example pc:c1, pc:c2, and I would like t

Sparql extract the comment from DBpedia

So my question is simple: from this URI -- http://dbpedia.org/snorql/?describe=http%3A%2F%2Fdbpedia.org%2Fresource%2FRed_Dragon_%28spacecraft%29 -- I want to extract specific things like -- rdfs:comment rdfs:label how to do that ?

Prioritizing attribute in Sparql query

This is a question about Sparql and Wikidata. I want to formulate a query that returns an instance-type relation, but if it's not available return its sub-class. I tried: SELECT DISTINCT ?ent_type WHERE { { wd:Q7696957 wdt:P31 ?instanceof . } UNION { wd:Q7696957 wdt:P31/wdt:P279? ?subclass . } UNION { wd:Q7696957 wdt:P279* ?subclass . } BIND ( IF (BOUND (?instanceof), ?instanceof, ?subclass ) as ?ent_type ) But unfortunately this returns all solutions, whereas I only want one

SPARQL Construct query Segmentation

I run a SPARQL construct query on DBpedia endpoint. The query is for getting all the information describing all movies: construct { ?s ?p ?o } where { ?s a <http://dbpedia.org/ontology/Film>. { SELECT ?s ?p ?o { ?s ?p ?o } group by ?s ?p } } The query works fine. The problem is DBpedia stops it at 10.000. I tried to make the offset 0 but it does make any difference. Also, I don't think chrome would support to display a million triple. Therefore, I was thinkin

How to choose a different query based on the subject of an object in SPARQL?

Let's say I have the following data subject = david predicate = knows object1 = Amy object2 = Brian subject = Amy predicate = gender object = female subject = Brian predicate = gender object = male Now I want to find all the people david knows but perform different queries based upon their gender so the pseudocode would look something like this: SELECT ?something WHERE{ david rdf:knows ?person if{?person rdf:gender "female"} { do this query} else if {?person rdf:gender "male"} {do this

How to query for publication date of books using SPARQL in DBPEDIA

I am trying to retrieve the publication date and the no.of pages for books in DBpedia. I tried the following query and it gives empty results. I see that these are properties under book(http://mappings.dbpedia.org/server/ontology/classes/Book) but could not retrieve it. I would like to know if there is an error in the code or if dbpedia does not store these dates related to books. SELECT ?book ?genre ?date ?numberOfPages WHERE { ?book rdf:type dbpedia-owl:Book . ?book dbp:genre ?ge

Selecting Food Calories from SPARQL

I've started looking into SPARQL and I admit I find it very obscure and difficult. I need to output the calories for all the foods. I don't really understand the difference between the wd: wdt: p: and ps: Similarly I am unclear on when to use P000 or Q000 ? The best I got so far is: SELECT ?food ?calories ?foodLabel ?caloriesLabel WHERE { ?food wdt:P31 wd:Q2095. ?food wdt:P31 ?calories. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Which gives : Results Any s

How to Select resources with specific property in dbpedia with Sparql Query?

I have the query -- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> #select count(DISTINCT ?instance) # The number of suitable instances #select DISTINCT ?instance ?type # Full Ground-truth dataset select DISTINCT ?instance ?domain ?range ?subClassOf # Full Algorithm input dataset (sampling might be required) where { ?instance rdf:type ?type; r

Sparql Set default value to property with SPIN

I am new to SPIN. I wonder if it makes sense to use it for the following purpose. Say I have the following class hierarchy: ex:Vehicle ex:Car ex:Sedan Some classes have the property owl:equivalenClass set to some value, for example: ex:Vehicle owl:equivalentClass wd:MeanOfTransportation ex:Sedan owl:equivalentClass wd:Sedan In the case owl:equivalentClass is not set to a value, it should take the value of it's parent class. In the above example: ex:Car owl:equivalentClass wd:Me

Sparql Create new ObjectProperty in Protege .The tag name is different

I found something different when I create a new ObjectProperty. This is my ontology. This ObjectProperty hasSymptom is been created But now when I create new ObjectProperty hasObject I founded when I create new Object Property. The tag name will different 1)rdf:about="http://www.semanticweb.org/pllab/ontologies/2013/11/untitled-ontology-2#"hasSymptom/> 2)rdf:about="&ont;hasObject" Why this happend? Thanks

Querying wikidata via SPARQL by resource identifier obtained from another query

I want to query wikidata with SERVICE keyword by giving it wikidata resource id fetched from my ontology into a variable. I store the wikidata id as string in my ontology. Normally, you need to tell wikidata endpoint which item you want by using prefixes(e.g. wd:Q1048). Here I need to do this by using a variable. Wikidate doesn't have a property for storing entity ids. So I need to give the Id as the subject in the query. Below in ?wid the stored variable is "wd:Q1048". It is a string so it isn'

SPARQL filter by date not working for DBpedia

I'm running the following query on http://dbpedia.org/snorql/ to get people born in a given city after a certain date: SELECT ?birth ?person WHERE { ?person dbo:birthPlace dbr:Paris . ?person dbo:birthDate ?birth . FILTER (?birth > "1900-01-01"^^xsd:date) . } LIMIT 1 I'm getting the following result: SPARQL results: birth person "1752-9-18"^^xsd:date :Adrien-Marie_Legendre How is this possible given that I'm filtering by dates after 1900-0

SPARQL: Exclude datatype uri from query result

I am trying to learn SPARQL queries on Protege and I have added some individuals to query on the Movie ontology found at : Movie Ontology I have following simple sparql query: Query 1: Get all movies and actors having rating more than 7.0 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 dbo: <http://dbped

How to find titles containing a string using SPARQL?

For example how can I find Wikimedia Commons categories containing the string "shape" in title, using SPARQL? Also I would like to ask how to change the script in order to: make the search case insensitive search whole words instead of string search articles instead of categories search Wikipedia elements instead of Wikimedia commons elements

Sparql comparing labels in a federated query

I have an instance of Wikibase running. I'm able to run federated queries with Wikidata successfully. I have certain queries that compare labels like this: PREFIX xwdt: <http://www.wikidata.org/prop/direct/> PREFIX xwd: <http://www.wikidata.org/entity/> PREFIX xpq: <http://www.wikidata.org/prop/qualifier/> PREFIX xps: <http://www.wikidata.org/prop/statement/> PREFIX xp: <http://www.wikidata.org/prop/> select ?item ?wditem ?itemLabel ?wid ?wditemlabel where { ?i

SPARQL/DBPedia: Fetch entity via properties without knowing entity page URI

I'm trying to return a property from an entity describing a company/stock on DBPedia given a unique combination of other properties that that entity belongs to. For example, given the strings NASDAQ and AAPL, I want to be able to find the http://dbpedia.org/page/Apple_Inc. page without explicitly knowing the URI. I know that this page contains properties dbp:symbol: AAPL dbp:tradedAs: dbr:NASDAQ-100 How would I use SPARQL to search dbp:symbol for AAPL directly and search dbp:tradedAs for a

Sparql What is the benefit of defining datatypes for literals in an RDF graph?

I am using rdflib in Python to build my first rdf graph. However, I do not understand the explicit purpose of defining Literal datatypes. I have scraped over the documentation and did my due diligence with google and the stackoverflow search, but I cannot seem to find an actual explanation for this. Why not just leave everything as a plain old Literal? From what I have experimented with, is this so that you can search for explicit terms in your Sparql query with BIND? Does this also help with F

Testing for identical sets of values in SPARQL (double negation)

In a question-answering systems I need to compare the set of questions users have answered to match the sets of questions associated to profiles, to group users in these profiles. I am trying to find, in a single query, tuples profile;user, where the user have answered all the questions associated to the profile, which I tend to interpret as there is no situation where a question of the profile is not answered by the user (double negation). Here is a dataset for which the expected answer is :p

SPARQL wikidata returns less countries instead of all

I am trying to list out all the countries. I tried this below query. It returns 166 results. But, I think total of more than 190, 200 countries are in the world. But, why it returns only 166 country names? Am I doing anything wrong here? This is silly question for some people, but I am new to SPARQL & wikidata Wikidata Query # list all countries SELECT ?country ?countryLabel WHERE { ?country wdt:P31 wd:Q6256 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }

Upload of TTL by sparql-update queryinto GraphDB fails on diacritics

Upload of turtle data using following bash script: #!/usr/bin/env bash RDF4J_ENDPOINT=endpoint_uri DIR="~/modelio/workspace/IPR/" IFS= FILE=tmp.rq function runUpdateQuery() { cp $1 $FILE sed -i -e "s!__VOC_IRI__!$2!g" $FILE curl --netrc-file .netrc -X POST -H "Content-type: application/sparql-update" -T $FILE $RDF4J_ENDPOINT/statements } function transform() { VOC_IRI=$1 PREFIX=$2 URL="$RDF4J_ENDPOINT/rdf-graphs/service?graph=$VOC_IRI" curl --netrc-file .netrc -X

Why can I not match a URI in a sparql query?

I'm writing a sparql query to search in the following rdfxml <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="PhysicalEntity0001"> <bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/> <bqbiol:isPartOf rdf:resource="https://identifiers.org/f

DBpedia SPARQL and predicate connection

I've got a problem with the DBpedia SPARQL endpoint because the properties of the properties like the label of rdf:type are not stocked in the endpoint. So when I run this query: SELECT * WHERE{ <http://dbpedia.org/ontology/Place> ?predicat ?object . OPTIONAL{?predicat rdfs:label ?label} } I've got nothing for ?label. If someone got any idea to solve this problem it would be very helpful.

SPARQL: Get "most specific property"

I'm trying to fetch the most specific properties for a class, and I'm stuck. I want to pull out all the properties that apply for a given class (including those inherited from superclasses), except those properties that have subproperties in the result set. For example, if I have a class Population with one of its properties being atLocation, and a subclass of Population called Refugees. Refugees has a property currentLocation, which is a subProperty of atLocation. So what I want is a generi

Sparql Director Filmography - all queries are returning empty

All, I'm trying to get a director's filmography from dbpedia: Both the queries below (and other attempts not shown) return empty sets. Query below doesn't work: PREFIX d: <http://dbpedia.org/ontology/> SELECT ?filmName WHERE { ?film d:director :woody_allen . ?film rdfs:label ?filmName . } Or (this is from) : PREFIX m: <http://data.linkedmdb.org/resource/movie/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?filmTitle WHERE { ?film rdfs:label ?

Querying court data by citation on DBpedia using SPARQL?

I'm new to DBpedia. What I'd like to be able to do is look up a case given it's legal citation. A legal citation usually involves a "volume", "reporter", and "page number". For example, for the case Loving v. Virginia, the DBPedia resource http://dbpedia.org/page/Loving_v._Virginia shows that the case has volume dbpprop:usvol = 388, page dbpprop:uspage = 1 (and the reporter is "US", which I suppose is baked into the usvol and uspage). So, what's the SPARQL query that I could use to retrieve a

Is it possible to get all classes and their respective instances using a single SPARQL query?

I have a requirement to show all the classes and their respective instances when the user accesses our website. We use Allegrograph as our RDF database. So once the user selects the repository from which to fetch the data, we need to show all the classes and their respective instances present in the entire repository. SO is it possible to achieve this through a single SPARQL query? I know the below SPARQL will fetch all the classes, SELECT DISTINCT ?class WHERE { ?s a ?class . } But how do

Sparql virtuoso, how to upload rdf files remotely using isql and ld_dir?

I am trying to upload *.ttl files in a virtuoso server using iSQL and the function ld_dir('path','file','graph'). If I run the thing in local everything works fine. I add the path in the DirsAllowed inside the virtuoso.ini config file. Then using the isql I run ld_dir(,,) and rdf_loader_run() and I upload the file. I would like to do the same thing but from a remote computer. How should I configure the virtuoso.ini to allow paths from a remote computer? Thanks, and sorry for the cross-posting

Sparql how to join the ABox for ontology with its corresponding owl

I got the owl for a books Ontology #----------------------------------------------------------------------------- # Prefixes #----------------------------------------------------------------------------- @prefix dbpedia-owl: <http://dbpedia.org/ontology/> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix gr: <http://purl.org/goodrelations/v1#> . @prefix owl: <http://www.w3.org/2002/07/owl

How to do a COUNT with conditions (IF or FILTER) in SPARQL

I need to do a count only if some conditions be true in SPARQL, something like this (doesn't work): SELECT ... COUNT(FILTER(?qualisScoreValue = "A1")) ?QNTD_A1 . COUNT(FILTER(?qualisScoreValue = "A2")) ?QNTD_A2 . COUNT(FILTER(?qualisScoreValue = "B1")) ?QNTD_B1 . I know mysql and I think that what I need should be equivalent in cases in mysql language like this (that works): select ... count(case when q.nameQualis = 'A1' then 1 else null end) as qntd_A1, count(case when q.nameQualis = 'A2' t

How to filter SPARQL query with Java variables

I have quiz game in which user have to answer questions like: What is German capital city name? Options are: Berlin Madrid London The data are in my owl file. I have another ontology also in which I have rdfs:comment of resources (options of quiz questions) like rdfs:comment of Berlin, London etc. I want if user choose the wrong option i-e London, rdfs:comment of right option should be displayed to user, Berlin in this case. The right (correct) option I have is in java variable 'correct' an

RDF and SPARQL: How to ask for an object of a property that is a subclass

I am getting into RDF modeling and have difficulties of applying properties with subClasses. I want to model a set of people and their capabilities in RDF and then want to query for people. For example, given the following RDF stuff: prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix d: <http://mytest.de/data#> prefix s: <http://mytest.de/types#> d:runningFast rdfs:subClassOf d:running . d:myPerson s:doe

SPARQL query on restriction list

I'm learning SPARQL and need some advices about a query. Exemple of the ontology : <owl:Class rdf:about="http://snomed.info/id/187903000"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <rdf:Description rdf:about="http://snomed.info/id/187900002"/> <owl:Restriction> <owl:onProperty rdf:resource="http://snomed.info/id/609096000"/>

Query in Sparql to get data of a person

I would like to have a list of all mountains names of the "dbo:firstAscentPerson" property of Lionel Terray (dbpedia: http://dbpedia.org/page/Lionel_Terray). But I am really struggling :( I will appreciate any help! This below is what I have so far select ?person ?firstAscentPerson where { ?person foaf:name "Lionel Terray"@en. dbo:firstAscentPerson rdfs:label ?firstAscentPerson. } LIMIT 100 Thanks a lot

How to count the number of distinct values, their names and the number of times each appeared per data property SPARQL

I m trying to make a SPARQL query that returns the number of distinct values of each data property of a Turtle file. I would like to know what the name of each value is and how many time each were repeated. I have created a simple ontology to test: @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix uni: <http://www.example.com/university#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd

  1    2   3   4   5   6  ... 下一页 最后一页 共 14 页