Jena TDB2 Assembler load data from file - jena

Hi guys I am trying to load data with TDB2 assembler
#prefix cq: <http://www.example.co.uk/hya>
#prefix tdb: <http://jena.apache.org/2016/tdb#> .
#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 text: <http://jena.apache.org/text#>
#prefix lm: <http://jena.hpl.hp.com/2004/08/location-mapping#>
#prefix dc: <http://purl.org/dc/elements/1.1/>
[] ja:loadClass "org.apache.jena.tdb2.TDB2" .
tdb:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB2 rdfs:subClassOf ja:Model .
<#dataset> rdf:type tdb:DatasetTDB2 ;
tdb:location "DB" ;
tdb:unionDefaultGraph true ;
.
<#data1> rdf:type tdb:GraphTDB ;
tdb:dataset <#dataset> ;
tdb:graphName <http://www.example.co.uk/hya/qdata> ;
ja:content [ja:externalContent <file:////Volumes/data/project/src/test/resources/metadata.ttl>;];
.
which is not working when i try to assemble dataset
Dataset dataset = TDB2Factory.assembleDataset("/Volumes/data/project/src/main/resources/tdb/tdb-assembler.ttl");
if(dataset ==null) {
log.debug("failed");
}else {
1. Model model = dataset.getUnionModel();
2. Model model = dataset.getNamedModel("<dataset>");
3. Model model = dataset.getDefaultModel();
dataset.begin(ReadWrite.WRITE);
model.write(System.out, Lang.TTL.getName());
}
I have tried to print model 3 different ways without success.
Can some suggest the best way to address this issue, and if there is any refrence documentation arounf TDB2.
Ideally i like to configure it later with following
:indexed-dataset
rdf:type text:TextDataset ;
text:dataset <#dataset> ;
text:index <#indexLuceneText> ;
.
# Text index description
<#indexLuceneText> a text:TextIndexLucene ;
text:directory <file:TDB/LUCENE> ;
text:entityMap <#entMap> ;
text:storeValues true ;
text:analyzer [ a text:StandardAnalyzer ] ;
text:queryAnalyzer [ a text:KeywordAnalyzer ] ;
text:queryParser text:AnalyzingQueryParser ;
text:multilingualSupport true ;
.
<#entMap> a text:EntityMap ;
according to assembler schema
"every model can has some content specified by a Content object."
ja:content a rdf:Property
; rdfs:label "Assembler.content"
; rdfs:comment
"""specifies that the subject Loadable is to be loaded with
all the contents specified by the object Content.
"""
; rdfs:domain ja:Loadable
; rdfs:range ja:Content
.

Persistent databases (TDB1, TDB2) don't process ja:content because that is a directive to load data each time into a memory model.
Instead, load the data with a TDB bulkloader beforehand.
For the text idnex,load the index with the textindexer command.
https://jena.apache.org/documentation/query/text-query.html

Related

Validating neo4j graph using SHACL, when a relationship can lead to a node belonging to one of two specific types

I have the following graph in neo4j (the below is a Cypher query that creates it).
CREATE (banana:Fruit {name:'Banana'})
CREATE (apple:Fruit {name:'Apple'})
CREATE (fruit_salad:Dish {name:'Fruit Salad'})
CREATE (banana_gun:Weapon {name:'Banana Gun'})
CREATE
(apple)-[:can_be_used_in]->(fruit_salad),
(banana)-[:can_be_used_in]->(fruit_salad),
(banana)-[:can_be_used_in]->(banana_gun)
I am trying to write a SHACL schema for validating this graph.
The tricky part here is that the relationship "can_be_used_in" can lead from Fruit to either Dish or Weapon type nodes.
I don't want to allow for any other relationships from the Fruit type, so I am using "sh:closed true ;".
I suspect what I need can be somehow done via the sh:or or sh:xone blocks.
I attempted this (again, a Cypher query for loading the schema):
call n10s.validation.shacl.import.inline('
#prefix neo4j: <neo4j://graph.schema#> .
#prefix sh: <http://www.w3.org/ns/shacl#> .
# ---- Fruit -------------
neo4j:FruitShape a sh:NodeShape ;
sh:targetClass neo4j:Fruit ;
sh:closed true ;
sh:property [
sh:path neo4j:name ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:datatype xsd:string ;
];
sh:or(
sh:property [
sh:path neo4j:can_be_used_in ;
sh:class neo4j:Weapon ;
]
sh:property [
sh:path neo4j:can_be_used_in ;
sh:class neo4j:Dish ;
]
);
.
','Turtle')
However this gives me the following output:
[{'focusNode': 552,
'nodeType': 'Fruit',
'shapeId': 'neo4j://graph.schema#FruitShape',
'propertyShape': 'http://www.w3.org/ns/shacl#ClosedConstraintComponent',
'offendingValue': '555, 554',
'resultPath': 'can_be_used_in',
'severity': 'http://www.w3.org/ns/shacl#Violation',
'resultMessage': 'Closed type definition does not include this property/relationship'},
{'focusNode': 553,
'nodeType': 'Fruit',
'shapeId': 'neo4j://graph.schema#FruitShape',
'propertyShape': 'http://www.w3.org/ns/shacl#ClosedConstraintComponent',
'offendingValue': '554',
'resultPath': 'can_be_used_in',
'severity': 'http://www.w3.org/ns/shacl#Violation',
'resultMessage': 'Closed type definition does not include this property/relationship'}]
Then, I attempted the following:
call n10s.validation.shacl.import.inline('
#prefix neo4j: <neo4j://graph.schema#> .
#prefix sh: <http://www.w3.org/ns/shacl#> .
# ---- Fruit -------------
neo4j:FruitShape a sh:NodeShape ;
sh:targetClass neo4j:Fruit ;
sh:closed true ;
sh:property [
sh:path neo4j:name ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:datatype xsd:string ;
];
sh:property [
sh:path neo4j:can_be_used_in ;
sh:or(
[
sh:class neo4j:Whatever ;
]
[
sh:class neo4j:ThisDoesntExist ;
]
);
] ;
.
','Turtle')
But this just returns an empty result (suggesting a successful validation), even though the types used in the 'or' statement don't exist.
I also attempted these with sh:xone instead, and that didn't work either.
I am at a loss here, is this a SHACL/neo4j integration issue, or am I using it wrong?
Below is my full example in Python, in case it helps:
from py2neo import Graph
graph = Graph(password="test_database")
graph.delete_all()
example_graph_query = """
CREATE (banana:Fruit {name:'Banana'})
CREATE (apple:Fruit {name:'Apple'})
CREATE (fruit_salad:Dish {name:'Fruit Salad'})
CREATE (banana_gun:Weapon {name:'Banana Gun'})
CREATE
(apple)-[:can_be_used_in]->(fruit_salad),
(banana)-[:can_be_used_in]->(fruit_salad),
(banana)-[:can_be_used_in]->(banana_gun)
"""
graph.run(example_graph_query)
shacl_schema="""
call n10s.validation.shacl.import.inline('
#prefix neo4j: <neo4j://graph.schema#> .
#prefix sh: <http://www.w3.org/ns/shacl#> .
# ---- Fruit -------------
neo4j:FruitShape a sh:NodeShape ;
sh:targetClass neo4j:Fruit ;
sh:closed true ;
sh:property [
sh:path neo4j:name ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:datatype xsd:string ;
];
sh:or(
sh:property [
sh:path neo4j:can_be_used_in ;
sh:class neo4j:Weapon ;
]
sh:property [
sh:path neo4j:can_be_used_in ;
sh:class neo4j:Dish ;
]
);
.
','Turtle')
"""
shacl_schema_ver_2="""
call n10s.validation.shacl.import.inline('
#prefix neo4j: <neo4j://graph.schema#> .
#prefix sh: <http://www.w3.org/ns/shacl#> .
# ---- Fruit -------------
neo4j:FruitShape a sh:NodeShape ;
sh:targetClass neo4j:Fruit ;
sh:closed true ;
sh:property [
sh:path neo4j:name ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:datatype xsd:string ;
];
sh:property [
sh:path neo4j:can_be_used_in ;
sh:or(
[
sh:class neo4j:Whatever ;
]
[
sh:class neo4j:ThisDoesntExist ;
]
);
] ;
.
','Turtle')
"""
data = graph.run(shacl_schema).data()
validation_query="""
call n10s.validation.shacl.validate()
"""
result = graph.run(validation_query)

Virtuoso R2RML rr:IRI generating

I have a problem with generating rr:termType rr:IRI in Virtuoso. I don't know if am I doing it wrong but I followed the W3C specification.
My mapping looks like this. When I generate triples with CONSTRUCT statement I still get "URL" but not IRI => <url> (OWNER_LINK and BRAND_LINK columns). Is it something Virtuoso doesn't support or am I coding it the wrong way?
DB.DBA.TTLP
( '
#prefix rr: <http://www.w3.org/ns/r2rml#> .
#prefix foaf: <http://xmlns.com/foaf/0.1/> .
#prefix gr: <http://purl.org/goodrelations/v1#> .
#prefix s: <http://schema.org/> .
#prefix pod: <http://linked.opendata.cz/ontology/product-open-data.org#> .
<#TriplesMap3>
a rr:TriplesMap ;
rr:logicalTable
[
rr:tableSchema "POD" ;
rr:tableOwner "DBA" ;
rr:tableName "BRAND_OWNER_BSIN"
];
rr:subjectMap
[
rr:template "http://linked.opendata.cz/resource/brand-owner-bsin/{BSIN}" ;
rr:class gr:BusinessEntity ;
rr:graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
];
rr:predicateObjectMap
[
rr:predicate gr:hasBrand ;
rr:objectMap
[
rr:parentTriplesMap <#TriplesMap4> ;
rr:joinCondition
[
rr:child "OWNER_CD" ;
rr:parent "OWNER_CD" ;
]; ]; ];
.
<#TriplesMap4>
a rr:TriplesMap ;
rr:logicalTable
[
rr:tableSchema "POD" ;
rr:tableOwner "DBA" ;
rr:tableName "BRAND_OWNER"
];
rr:subjectMap
[
rr:template "http://linked.opendata.cz/resource/brand-owner/{OWNER_CD}" ;
rr:class gr:BusinessEntity ;
rr:graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
];
rr:predicateObjectMap
[
rr:predicate gr:legalName ;
rr:objectMap
[ rr:column "OWNER_NM" ];
];
rr:predicateObjectMap
[
rr:predicate s:url ;
rr:objectMap
[
rr:termType rr:IRI ;
rr:column {OWNER_LINK} ;
]; ];
rr:predicateObjectMap
[
rr:predicate gr:hasBrand ;
rr:objectMap
[
rr:parentTriplesMap <#TriplesMap3> ;
rr:joinCondition
[
rr:child "OWNER_CD" ;
rr:parent "OWNER_CD" ;
]; ]; ];
.
<#TriplesMap2>
a rr:TriplesMap;
rr:logicalTable
[
rr:tableSchema "POD";
rr:tableOwner "DBA";
rr:tableName "BRAND_TYPE"
];
rr:subjectMap
[
rr:template "http://linked.opendata.cz/resource/brand-type/{BRAND_TYPE_CD}" ;
rr:class gr:BusinessEntityType ;
rr:graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
];
rr:predicateObjectMap
[
rr:predicate gr:name ;
rr:objectMap
[ rr:column "BRAND_TYPE_NM" ];
];
.
<#TriplesMap1>
a rr:TriplesMap;
rr:logicalTable
[
rr:tableSchema "POD" ;
rr:tableOwner "DBA" ;
rr:tableName "BRAND"
];
rr:subjectMap
[
rr:template "http://linked.opendata.cz/resource/brand/{BSIN}" ;
rr:class gr:Brand ;
rr:graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
];
rr:predicateObjectMap
[
rr:predicate pod:bsin ;
rr:objectMap [ rr:column "BSIN" ] ;
];
rr:predicateObjectMap
[
rr:predicate gr:name ;
rr:objectMap [ rr:column "BRAND_NM" ] ;
];
rr:predicateObjectMap
[
rr:predicate s:url ;
rr:objectMap
[
rr:termType rr:IRI ;
rr:column "BRAND_LINK" ;
]; ];
rr:predicateObjectMap
[
rr:predicate gr:BusinessEntityType ;
rr:objectMap
[
rr:parentTriplesMap <#TriplesMap2> ;
rr:joinCondition
[
rr:child "BRAND_TYPE_CD" ;
rr:parent "BRAND_TYPE_CD" ;
]; ]; ];
.
',
'http://product-open-data.org/temp',
'http://product-open-data.org/temp'
);
exec ( 'sparql ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('http://product-open-data.org/temp') );
So I figured out my code was wrong it should be like this
rr:predicateObjectMap
[
rr:predicateMap
[
rr:constant s:url
];
rr:objectMap
[
rr:termType rr:IRI ;
rr:template "{BRAND_LINK}" ;
];
];.
and it's working
Thank you.
To be clear — are you saying the R2RML mapping is loading successfully, but when running a SPARQL CONSTRUCT query, the rr:termType rr:IRI mapping is not being displayed in the result set?
As the docs indicate, only rr:sqlQuery is not currently supported ...

Grails/GORM BigInteger Unsigned Rejected

I'm getting the following error:
| Error 2014-08-18 11:25:00,324 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Validation Error(s) occurred during save():
- Field error in object 'my.package.Content' on field 'fileNameLookup': rejected value [16731516642733300018]; codes [my.package.Content.fileNameLookup.typeMismatch.error,my.package.Content.fileNameLookup.typeMismatch,content.fileNameLookup.typeMismatch.error,content.fileNameLookup.typeMismatch,typeMismatch.my.package.Content.fileNameLookup,typeMismatch.fileNameLookup,typeMismatch.java.lang.Long,typeMismatch]; arguments [fileNameLookup]; default message [Could not convert number [16731516642733300018] of type [java.math.BigInteger] to target class [java.lang.Long]: overflow]
Message: Validation Error(s) occurred during save():
- Field error in object 'my.package.Content' on field 'fileNameLookup': rejected value [16731516642733300018]; codes [my.package.Content.fileNameLookup.typeMismatch.error,my.package.Content.fileNameLookup.typeMismatch,content.fileNameLookup.typeMismatch.error,content.fileNameLookup.typeMismatch,typeMismatch.my.package.Content.fileNameLookup,typeMismatch.fileNameLookup,typeMismatch.java.lang.Long,typeMismatch]; arguments [fileNameLookup]; default message [Could not convert number [16731516642733300018] of type [java.math.BigInteger] to target class [java.lang.Long]: overflow]
Line | Method
->> 6 | doCall in BootStrap$_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
| 320 | executeForEnvironment . . . . . in ''
| 296 | executeForCurrentEnvironment in ''
| 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
Forked Grails VM exited with error
Domain class:
package my.package
// need to fix constraints
class Content {
// int id
Long fileNameLookup
static mapping = {
version false
fileNameLookup column: 'file_name_lookup', type:org.hibernate.type.LongType, class: Long
}
static constraints = {
fileNameLookup(nullable:true, display:false, editable: false)
}
}
Bootstrap.groovy:
import my.package.Content
class BootStrap {
def init = { servletContext ->
new Content(fileNameLookup:16731516642733300018).save(failOnError:true)
}
def destroy = {
}
}
I tried Long, BigInteger, Integer, etc... and burnt hours on this trying to figure out how to get this bigint(20) unsigned to save into the test db. How do i tell Grails/Gorm that the number is a bigint(20) so that it can handle it properly regardless of the database that i'm using?
Long.MAX_VALUE is 9,223,372,036,854,775,807. Your number is too big for it. Using BigDecimal should fix this.
BigDecimal fileNameLookup

How do I avoid getting duplicate key errors when using findOrSaveBy dynamic finders in Grails?

In a concurrent situation (asynchronous file uploads) where I try to create (or reuse) and attach keyword tags to images in an image library application i get a Unique index or primary key violation when creating Tag domain objects.
The controller calls a service method to add an image to the library and also the keyword tags that belongs to it.
Am I going about this the wrong way or am I missing something?
I'm currently using Grails 2.3.5.
Code:
class ImageAssetService {
def addTagToImage(ImageAsset imageAsset, String kw, String locale) {
def tagName = kw.toLowerCase(Locale.forLanguageTag(locale))
// OFFENDING LINE NEXT
def tag = Tag.findOrSaveByNameAndLocale(tagName, locale, [lock: true])
imageAsset.addToTags(tag)
if(!imageAsset.save()) {
throw new ImageAssetException()
}
imageAsset
}
def addTagsToImage(ImageAsset imageAsset, Set<String> keywords, String locale) {
keywords.each { kw ->
addTagToImage(imageAsset, kw, locale)
}
imageAsset
}
// CONTROLLER CALLS THIS METHOD
def addImageAsset(InputStream inputStream, String filename, long fileSize, long authorId, String timeZoneOriginal, String heading, String description, Set tags, String imageCollectionName) {
// Create the ImageAsset domain object
ImageAsset imageAsset = new ImageAsset(
filename: filename,
fileSize: fileSize,
author: Author.get(authorId),
timeZoneOriginal: TimeZone.getTimeZone(timeZoneOriginal),
heading: heading,
description: description
).save()
// Add any tags
addTagsToImage(imageAsset, tags, 'en')
/*
...
CODE REMOVED FOR BREVITY
....
*/
return imageAsset
}
}
class Tag {
String locale
String name
static hasMany = [ translations : Tag, synonyms : Tag ]
void setName(String name) { this.#name = name.toLowerCase() }
static constraints = {
locale unique: ['name']
}
static belongsTo = ImageAsset
static searchable = {
except = ['locale']
name boost: 2.0
translations component: [prefix: 'translations_', maxDepth: 2]
synonyms component: [prefix: 'synonyms_', maxDepth: 2]
}
static mapping = {
table 'tags'
}
}
class ImageAsset {
String filename
String heading
String description
String place
String city
String country
String gps
long fileSize = 0
int pixelWidth = 0
int pixelHeight = 0
Date dateTimeOriginal
TimeZone timeZoneOriginal
boolean enabled = true
Date dateCreated
static belongsTo = [
Author,
ConceptualImageCategory,
RepresentativeImageCategory,
ImageCollection
]
static hasOne = [ author : Author ]
static hasMany = [
conceptualCategories : ConceptualImageCategory,
representativeCategories : RepresentativeImageCategory,
collections : ImageCollection,
metadata : Metadata,
tags : Tag
]
static constraints = {
filename blank: false
heading nullable: true
description nullable: true
place nullable: true
city nullable: true
country nullable: true
gps nullable: true
pixelWidth nullable: true
pixelHeight nullable: true
dateTimeOriginal nullable: true
timeZoneOriginal nullable: true
}
static mapping = {
description type: 'text'
}
static searchable = {
//only = ['filename', 'heading', 'description', 'tags', 'metadata']
author component: [prefix: 'author_']
tags component: [prefix: 'tags_']
metadata component: [prefix: 'metadata_']
}
}
Error message:
Unique index or primary key violation: "CONSTRAINT_INDEX_27 ON PUBLIC.TAGS(NAME, LOCALE) VALUES ( /* key:11 */ 895, 0, 'en', 'work')"; SQL statement:
insert into tags (id, version, locale, name) values (null, ?, ?, ?) [23505-173]. Stacktrace follows:
Message: Unique index or primary key violation: "CONSTRAINT_INDEX_27 ON PUBLIC.TAGS(NAME, LOCALE) VALUES ( /* key:11 */ 895, 0, 'en', 'work')"; SQL statement:
insert into tags (id, version, locale, name) values (null, ?, ?, ?) [23505-173]
Line | Method
->> 331 | getJdbcSQLException in org.h2.message.DbException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 171 | get in ''
| 148 | get . . . . . . . . . . in ''
| 101 | getDuplicateKeyException in org.h2.index.BaseIndex
| 68 | add . . . . . . . . . . in org.h2.index.TreeIndex
| 52 | add in org.h2.index.MultiVersionIndex
| 125 | addRow . . . . . . . . . in org.h2.table.RegularTable
| 127 | insertRows in org.h2.command.dml.Insert
| 86 | update . . . . . . . . . in ''
| 79 | update in org.h2.command.CommandContainer
| 235 | executeUpdate . . . . . in org.h2.command.Command
| 154 | executeUpdateInternal in org.h2.jdbc.JdbcPreparedStatement
| 140 | executeUpdate . . . . . in ''
| 102 | doCall in org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2
| 105 | addTagToImage . . . . . in se.originalab.imagedb.ImageAssetService
| 94 | doCall in se.originalab.imagedb.ImageAssetService$_addTagsToImage_closure3
| 93 | addTagsToImage . . . . . in se.originalab.imagedb.ImageAssetService
| 45 | addImageAsset in ''
| 31 | upload . . . . . . . . . in se.originalab.imagedb.UploadController
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 49 | doFilter . . . . . . . . in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1110 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . in java.lang.Thread
I found a solution myself. I had to break out the creation of a Tag into it's own transaction. Each call to Tag.findOrSaveByNameLocale() is now called through a synchronized service method from the controller. Then I add them to the ImageAsset afterwards.
One problem with this is that if the creation of the ImageAsset fails the Tags will still be persisted, but in my use case this is not a big problem.

HTTP POST to SPARQL server, get empty HTTP 200 back

I'm sending an HTTP POST request to http://api.artsholland.com/sparql?apiKey=27b6abd4129fc9ced3aa5390fd4fb15b
with this query:
string query =
"PREFIX ah: <http://purl.org/artsholland/1.0/> "
"PREFIX data: <http://data.artsholland.com/> "
"PREFIX nub: <http://resources.uitburo.nl/> "
"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 dc: <http://purl.org/dc/terms/> "
"PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema/> "
"PREFIX time: <http://www.w3.org/2006/time/> "
"PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos/> "
"PREFIX vcard: <http://www.w3.org/2006/vcard/ns/> "
"PREFIX osgeo: <http://rdf.opensahara.com/type/geo/> "
"PREFIX bd: <http://www.bigdata.com/rdf/search/> "
"PREFIX search: <http://rdf.opensahara.com/search/> "
"PREFIX fn: <http://www.w3.org/2005/xpath-functions/> "
"PREFIX gr: <http://purl.org/goodrelations/v1/> "
"SELECT ?v ?p ?date ?title ?desc ?modified ?type ?genre "
"WHERE { "
"?v a ah:Venue . "
"?p dc:modified ?modified . "
"?e ah:venue ?v . "
"?e ah:production ?p . "
"OPTIONAL {{ "
"?p dc:title ?title . "
"}} "
"OPTIONAL {{ "
"?p ah:shortDescription ?desc . "
"}} "
"OPTIONAL {{ "
"?p ah:productionType ?type . "
"}} "
"OPTIONAL {{ "
"?p ah:genre ?genre . "
"}} "
"?v geo:geometry ?geometry . "
"FILTER (search:distance(?geometry, \"POINT(4.890 52.3764)\"^^<http://rdf.opensahara.com/type/geo/wkt>) < 2000 * " "0.00000898315284) . "
"?e time:hasBeginning ?date . "
"FILTER (?date >= \"2012-09-06T00:00:00Z\"^^xsd:dateTime) . "
"FILTER (?date <= \"2012-09-06T23:59:59Z\"^^xsd:dateTime) . "
"} ORDER BY ?v "
"LIMIT 100 ";
with these form fields:
ofxHttpForm form;
form.action = action_url;
form.method = OFX_HTTP_POST;
form.addFormField("query", query);
form.addFormField("output", "json");
httpUtils.addForm(form);
I get an 200 OK back, but no body. I've adapted the query several times, but still no valid return :(
The library used is https://github.com/arturoc/ofxHttpUtils
I tried your SPARQL query on the same endpoint (using the endpoint's web interface) with both the demo key and your key, but got HTTP 500 Internal server errors (instead of empty HTTP 200 responses).
I did get results when I used the correct namespaces and replaced "{{" by "{" in OPTIONAL blocks. The namespaces that the web interface predefines are
PREFIX ah: <http://purl.org/artsholland/1.0/>
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 dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
PREFIX osgeo: <http://rdf.opensahara.com/type/geo/>
PREFIX bd: <http://www.bigdata.com/rdf/search#>
PREFIX search: <http://rdf.opensahara.com/search#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
PREFIX gr: <http://purl.org/goodrelations/v1#>
PREFIX gn: <http://www.geonames.org/ontology#>
You have to use these (note the # instead of / in some of them, it matters).

Resources