I'm trying to get the data property value of my individual from an existing ontology. I'm using OWL API.
For example the name of my inidividual :
`
Set<OWLLiteral> literalA = John.getDataPropertyValues(name, ontology);
I've got this error :
> The method getDataPropertyValues(OWLDataPropertyExpression,
> OWLOntology) is undefined for the type OWLIndividua
`
This should get me : "John"
I've checked on this website the methods I can use to retrieve the information Interface OWLIndividual and it gave me getDataPropertyValues. Unfortunately, I can't make it work.
Any idea ?
Thanks for your help
Related
I'm doing a dashboard about covid. I want to use a json file but the way data is encapsulated causes me an issue.
As you can see, the "real" name of the country is written inside the "location" field inside the "airport" name. Is there a way I can sort of bypass the "airport" name to access "location" field ? (Maybe like going through all of the "airport" names and search for location inside of them or looking for "location" field directly). Then I will be able to check if the country written in the input matches with one country inside the json file.
There are only these 2 layers ("airport" name & what's inside) in the json file.
About my code, I'm usig react. For now I just fecth the url of the json file to get it.
Thanks in advance !
Just in case someone faces the same issue as me, this helped me find what to do :
Object.keys(data)
Creates an array consisting of all the keys present in the object
Object.values(data)
Creates an array consisting of all the values present in the object
Object.entries(data)
Creates an array consisting of both the keys and values present in the object
In my case, to get location I do this :
for (var i = 0; i < Object.values(data).length; i++) {
if (this.state.country === Object.values(data)[i].location) {
this.setState({
post: Object.values(data)[i]
})
}
}
While i try to add new document to the DB with geoFirestore and try to set one of the property as array with DocumentReference (refers to a document location in a Firestore database) i get the following error:
FirebaseError: Function DocumentReference.set() called with invalid data. Unsupported field value: a custom object
If i set there an empty array its success.
BTW if i set there a string or number its work too
The inseration code:
await geocollection.add({
coordinates: new firebase.firestore.GeoPoint(latlng.lat, latlng.lng),
arrayOfRef: [newRef]
});
I try to use Object.asset() to the newRef but get the same result.
Thanks for the helpers.
So in a lot of cases geofirestore minimally modifies the doc you give and then passes it through to Firestore. In this case it looks like Firebase/Firestore is throwing the error, not geofirestore.
I suspect that the issue is with the reference you're using. If that reference is provided by geofirestore, it's not necessarily a DocumentReference that Firestore uses, it is a GeoDocumentReference. You'll likely want to get the actual DocumentReference from the native property:
await geocollection.add({
coordinates: new firebase.firestore.GeoPoint(latlng.lat, latlng.lng),
arrayOfRef: [newRef.native]
});
Let me know if that helps! I'm also making a few assumptions as to your code, so seeing more of what happens before you call the add method would be awesome.
I have a model wich checks a lot of things in beforeSave callback. I do not want to use cakephp validation system for that purpose because it is more simple for me in this case.
If the checking chain fails in somewhere I return false and no saving happens, It is the normal work. I want to give back informal error messages in the entity to use it in the controller and/or view.
How I can do that?
Example:
public function beforeSave($event, $entity, $options)
{
if($entity->isNew())
{
if(fail1) $entity->inserterrormessage('XYZ is missing');
if(fail2) $entity->inserterrormessage('Please check if...');
}
}
How I can do that?
Via the errors() method, or as of CakePHP 3.4 the setError() and setErrors() methods.
$entity->errors('propertyName', ['Message']);
$entity->setErrors(['propertyName' => ['Message']]);
$entity->setError('propertyName', ['Message']);
In case the error isn't related to an actual entity property, just choose a special name, like _generic. Alternatively create custom generic error storage functionality in a base entity or trait.
See also
Cookbook > Database Access & ORM > Entities > Validation Errors
API > \Cake\DataSource\EntityTrait::errors()
API > \Cake\DataSource\EntityTrait::setError()
API > \Cake\DataSource\EntityTrait::setErrors()
I have read and worked with the other posts about this and it appears the version of Laravel 4 I just downloaded has more changes made to the way the JSON input is handled by a controller.
$input = Input::json()->all(); gives me errors as if I am referring to something that does not exist when I request some part of the payload after doing a PUT request. And without ->all(); I get a symfony error.
Does anyone know how to get good JSON from backbone in Laravel 4's latest version?
Currently, I am doing the long way around to get my data, ie:
$input_title = Input::get('title');
$input_completed = Input::get('completed');
$task = Task::find($id);
$task->title = $input_title;
$task->completed = $input_completed;
$task->save();
Yes, I am doing the tutorial on tutsplus to learn laravel/backbone, so a little noob patience is apreciated.
The error I get when using Input::get(); is:
{"error":{"type":"UnexpectedValueException","message":"The Response content must be a string or object implementing __toString(), \"array\" given.","file":"/Users/brentlawson23/Sites/laravel4App/bootstrap/compiled.php","line":16858}}
I really want to get the Laravel-specific answer instead of using straight php to stringify the payload.
I get same error using just Input::json();
For the current beta of Laravel 4, Input::json(); is not getting a stringified version of the request payload that can be used to create a new row in a table, nor does Input::json()->all(); (hoping to play nice with the ParameterBag from symfony). I have tried json_encode among other hacks and basically every step of the way in this tut, I hit some brick wall. Anyone have a suggestion based on what I have presented here?
Today I got this when simply trying to echo the result of $input = Input::json(); :
{"error":{"type":"ErrorException","message":"Catchable Fatal Error: Object of class Symfony\Component\HttpFoundation\ParameterBag could not be converted to string in /Users/brentlawson23/Sites/laravel4App/app/controllers/TasksController.php line 45","file":"/Users/brentlawson23/Sites/laravel4App/app/controllers/TasksController.php","line":45}}
Yes, I have studied the Symfony API.
I had a similar problem. Input from Backbone is converted to array in Laravel. On tutsplus, Jeffrey Way is using object. So I was trying to do this (like in tutorial):
return $input->title // using object,but got an error.
If I change that line to:
return $input["title"] // everything works fine with array.
I'm also working through the Backbone tutorial on tuts+. If I'm right in assuming are you stuck on the Creating New Contacts section? Below is how I got it to work for me, in ContactController.php:
public function store()
{
$input = Input::all();
Contact::create(array(
'first_name' => $input['first_name'],
'last_name' => $input['last_name'],
'email_address' => $input['email_address'],
'description' => $input['description']
));
}
And then also needed to update app/models/Contact.php with the below:
class Contact extends Eloquent {
protected $fillable = array('first_name', 'last_name', 'email_address', 'description');
}
That should get it working for you and insert the contact into the database. If I've misread let me know and I can have another look.
Cheers,
Sean
I have a custom object in SalesForce called Deal, which is a child of the built-in Account object. I am trying to use the Bulk XML API to upload a batch of records, but I can't seem to figure out how to specify this relationship correctly. From the documentation it says that you should reference a custom object's relationships like so:
<Relationship__r>
<sObject>
<some_indexed_field>#####</some_indexed_field>
</sObject>
</Relationship__r>
If you have any idea how to specify a relationship to the Account object from a custom object I'd really appreciate it.
Added
The Deal object has the following 2 fields:
DealID
API Name - DealID__c
Data Type - Text(255)(External ID)(Unique Case Sensitive)
Account
API Name - Account__c
Data Type - Master-Detail(Account)
Request XML:
<Account__r>
<sObject>
<ID>0013000000kcWpfAAE</ID>
</sObject>
</Account__r>
Result XML:
<result>
<errors>
<message>Field name provided, Id is not an External ID or indexed field for Account</message>
<statusCode>INVALID_FIELD</statusCode>
</errors>
<success>false</success>
<created>false</created>
</result>
There appears to be a bug and you have to strip out all whitespace and newlines when dealing with reference objects.
Check out:
http://success.salesforce.com/ideaview?id=08730000000ITQ7AAO
From the docs
<RelationshipName>
<sObject>
<IndexedFieldName>rwilliams#salesforcesample.com</IndexedFieldName>
</sObject>
Everything looks good, but instead of using "ID" for the Indexed Field Name, you need to use "Account__c". That should take care of your issue.