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).
Related
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
The following code open a random number generator, selects the button to run the generator, and returns a random number.
#Start-Process
$ie = New-Object -com InternetExplorer.Application
$ie.Navigate("https://www.random.org/widgets/integers/iframe.php?title=True+Random+Number+Generator&buttontxt=Generate&width=160&height=200&border=on&bgcolor=%23FFFFFF&txtcolor=%23777777&altbgcolor=%23CCCCFF&alttxtcolor=%23000000&defaultmin=1&defaultmax=100&fixed=off")
$ie.visible = $true
echo "Random.org opening"
while( $ie.busy){Start-Sleep 1}
sleep 10
echo "Random.org open"
$FindBtn = $ie.Document.getElementByID("true-random-integer-generator-button").click()
sleep 5
$result = $ie.Document.getElementByID("true-random-integer-generator-result").innerHTML
echo $result
This works fine for me in powershell 2.0, however, when I run in 4.0, iget the following errors:
You cannot call a method on a null-valued expression.
At line:13 char:1
+ $FindBtn = $ie.Document.getElementByID("true-random-integer-generator-button").c
...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:15 char:1
+ $result = $ie.Document.getElementByID("true-random-integer-generator-result").in
...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
What is the reason behind this? Is there a big formatting difference between powershell 4.0 and 2.0? 4.0 is on a different VM to 2.0, could that be having an affect?
I have made the following script from google for backing up the SSRS Encryption keys:
cls
$pwd = "sa#123#123"
$SSRSClass = Get-Wmiobject -namespace "root\microsoft\sqlserver\reportserver\rs_BPSSRS\v10\admin" -class "MSReportServer_ConfigurationSetting"
$key = $SSRSClass.BackupEncryptionKey($pwd)
$stream = [System.IO.File]::Create("c:\\SSRS.snk", $key.KeyFile.Length)
$stream.Write($key.KeyFile, 0, $key.KeyFile.Length)
$stream.Close()
But I'm getting the following errors:
Method invocation failed because [System.Object[]] doesn't contain a method named 'BackupEn
cryptionKey'.
At line:5 char:38
+ $key = $SSRSClass.BackupEncryptionKey <<<< ($results)
+ CategoryInfo : InvalidOperation: (BackupEncryptionKey:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : MethodNotFound
Exception calling "Create" with "2" argument(s): "Positive number required.
Parameter name: bufferSize"
At line:6 char:35
+ $stream = [System.IO.File]::Create <<<< ("c:\\SSRS.snk", $key.KeyFile.Length)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At line:7 char:14
+ $stream.Write <<<< ($key.KeyFile, 0, $key.KeyFile.Length)
+ CategoryInfo : InvalidOperation: (Write:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:8 char:14
+ $stream.Close <<<< ()
+ CategoryInfo : InvalidOperation: (Close:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I'm using powershell v2. I tried finding about this but no luck. There are around 50+ SSRS servers in our environment and doing backup manually is tiresome. Hence, we came up with this automation. Kindly provide your comments.
Thanks
This piece of code should do the trick:
$ComputerName = "."
$KeyFolder = "C:\Temp"
$KeyPassword = "sa#123#123"
$TimeStamp = Get-Date -Format "-yyyyMMdd-HHmmss"
Get-WmiObject -Namespace "Root\Microsoft\SqlServer\ReportServer" -Class "__Namespace" -ComputerName $ComputerName |
Select-Object -ExpandProperty Name |
% {
$NameSpaceRS = $_
$InstanceName = $NameSpaceRS.SubString(3)
$KeyFileName = Join-Path -Path $KeyFolder -ChildPath ($InstanceName + $Timestamp + ".snk")
"Found Reporting Services in instance '$($InstanceName)' on $($ComputerName); will save key to '$($KeyFileName)' ..."
$SQLVersion = (Get-WmiObject -Namespace "Root\Microsoft\SqlServer\ReportServer\$($NameSpaceRS)" -Class "__Namespace" -ComputerName $ComputerName).Name
$SSRSClass = Get-WmiObject -Namespace "Root\Microsoft\SqlServer\ReportServer\$($NameSpaceRS)\$($SQLVersion)\Admin" -Query "SELECT * FROM MSReportServer_ConfigurationSetting WHERE InstanceName='$($InstanceName)'" -ComputerName $ComputerName
$Key = $SSRSClass.BackupEncryptionKey($KeyPassword)
If ($Key.HRESULT -ne 0) {
$Key.ExtendedErrors -join "`r`n" | Write-Error
} Else {
$Stream = [System.IO.File]::Create($KeyFileName, $Key.KeyFile.Length)
$Stream.Write($Key.KeyFile, 0, $Key.KeyFile.Length)
$Stream.Close()
}
}
The errors that you have mentioned are because your code is trying to fetch information from duplicate entries. Meaning, if you try the above code on the server where only one named instance of SSRS is running, then I suppose it will succeed. Just try this piece and give your comments.
CHEERS.
I need to write a Jersey Client in Spring.
Using CURL, this works:
curl --header "Authorization: Basic aaaaaaabbbbb" --header "Content-Type: application/json" --request POST "http://163.162.8.112:9000/path" --data #TestWrapperJob.json
--> return a STRING
-- TestWrapper.json
{ "name": "job2aad",
"description": "Descrizione test job1",
"tests": [ {
"TestPath": "EsempiRiccardo\\TestWrapper",
"TestDuration": "2"
} ],
"topology": null
}
Now I'm trying to translate in JAVA, but i get HTTP ERROR 400
Client client = Client.create();
String temp = "{ \"name\": \"job2aad\", "
+ " \"description\": \"Descrizione test job1\", "
+ " \"tests\": [ { "
+ " \"TestPath\": \"EsempiRiccardo\\TestWrapper\", "
+ " \"TestDuration\": \"2\" "
+ " } ], "
+ " \"topology\": null "
+ "}";
WebResource webResource = client.resource("http://163.162.8.112:9000/path");
ClientResponse response = webResource.header("Authorization", "Basic aaaaaaabbbbb")
.type("application/json")
.post(ClientResponse.class, temp);
What's wrong?
Riccardo
Ok, sorry to all...
I found the answer
+ " \"TestPath\": \"EsempiRiccardo\\TestWrapper\", "
should be
+ " \"TestPath\": \"EsempiRiccardo\\\\TestWrapper\", "
I have a long text for LabelField. But LabelField doesn't show all. I dont know how to fix it, what should I do?
I am using default labelfield.
manager
.add(new LabelField(
"IP kameranıza hemen bağlanmak için\n Ana Menüdeki \"Kameralarım\""
+ "butonuna tıklayınız. Açılan sayfadaki menüden \n\"Yeni Ekle\"yi seçip "
+ "kameranızın modelini, IP numarasını, port numarasını varsa kullanıcı adı ve şifresini "
+ "girip kayediniz. Eğer video server kullanıyorsanız \"Server Numarası\" "
+ "alanına izlemek istediğiniz kameranın numarasını(1,2,3 vb.) giriniz. "
+ "Normal bir IP kamera kullanıyorsanız \"Server Numarası\" alanını boş bırakınız. "
+ "Kamera listesinden istediğiniz kamerayı seçip menüden \"Izle\" seçeneğini "
+ "seçerek kameranızı izlemeye başlayabilirsiniz.Tam Ekran izlemek için "
+ "telefonunuzu yatay konumda tutunuz. Kameranızın PTZ özelliği varsa "
+ "ekranda görünen butonları kullanabilirsiniz.",
DrawStyle.HCENTER | USE_ALL_HEIGHT)
You want to use a TextField instead of a LabelField