How to extract freebase' data for triples(entity,relation,entity)? - extract

I want to extract freebase'data for triples(entity,relation,entity),but the api of freebase is closed.

Related

Loosing data from Source to Sink in Copy Data

In my MS Azure datafactory, I have a rest API connection to a nested JSON dataset.
The Source "Preview data" shows all data. (7 orders from the online store)
In the "Activity Copy Data", is the menu tab "Mapping" where I map JSON fields with the sink SQL table columns. If I under "Collection Reference" I select None, all 7 orders are copied over.
But if I want the nested metadata, I select the meta field in "Collection Reference", then I get my nested data, in multiple order lines, each with a one metadata point, but I only get data from 1 order, not 7
I think I have a reason for my problem. One of the fields in the nested meta data, is both a string and array. But I still don't have a solution
sceen shot of meta data
Your sense is right,it caused by your nested structure meta data. Based on the statements of Collection Reference property:
If you want to iterate and extract data from the objects inside an
array field with the same pattern and convert to per row per object,
specify the JSON path of that array to do cross-apply. This property
is supported only when hierarchical data is source.
same pattern is key point here, I think. However, your data inside metadata array are not same as your screenshot.
My workaround is using Azure Blob Storage to make a transition, REST API ---> Azure Blob Storage--->Your sink dataset. Inside Blob Storage Dataset, you could flatten the incoming JSON data with Cross-apply nested JSON array setting:
You could refer to this blog to learn about this feature. Then you could copy the flatten data into your destination.

How to validate two JSON objects present in a string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a JSON String to validate which contains two separate objects. The string is "1A" but i want to validate it as individual objects for example: {"NumberInt":1,"LetterThing":"A"}.
In conclusion, my string is "1A" but I need to validate it as individual objects despite the fact it's in a string format.
Why do I want this? I have a minimum and maximum for the NumberInt integer value and I have a particular pattern for the LetterThing string value. For example: I do not want "5H" to validate.
If this is possible in a string format please let me know how.
Solved:
Was solved by using regex to validate on my JsonSchema i.e "pattern": "^[A-Ja-j1-4\\s]*$".
Thanks guys
You could use a regex to extract what you need from the JSON.
//obtains the number part, then you can perform operations on that number
var startingDigits = incomingString.replace( /^\D+/g, '');
You would need to PARSE the string in this case.
To parse a STRING you ITERATE over each CHARACTER in the string and then compose the needed parsed ELEMENTS.
For example in this CASE you might start looking for only DIGITS and putting them in another string. When you hit a LETTER you can CONVERT that string to an integer.
Then take the REMAINING as the 2nd part.
Finally do your VALIDATION.

Other data input format than flat json for crossfilter?

When using crossfilter (for example for dc.js), do I always need to transform my data to a flat JSON for input?
Flat JSON data when reading from AJAX requests tend to be a lot larger than it needs to be (in comparison to for example nested JSON, value to array or CSV data).
Is there an API available which can read in other types than flat json? Are there plans to add those?
I would like to avoid to let the client transform the data before using it.

What is the advantage of N-Triples over CSV for storing RDF triples? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
N-Triples is a line based serialization format for an RDF graph. Each line represents the subject, predicate and object of an RDF Triple separated by whitespace and ended with a dot like:
<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> .
More details can be found here: http://www.w3.org/TR/n-triples/
But why is it necessary to define such a format, if one could serialize RDF Triples simply using CSV like
http://one.example/subject1, http://one.example/predicate1, http://one.example/object1
I could even easily extend to support N-Quads, N-Quints, ... using CSV. What are the advantages of N-Triples over CSV for serializing RDF triples?
Disclaimer: I'm the original editor of N-Triples and implemented it in Raptor http://librdf.org/raptor/ both the N-Triples original and the 2013 version.
There are multiple answers to this but it's basically ambiguity. CSV can't distinguish between a URI that looks like http://foo.com/ and a string http://foo.com/
In CSV
http://foo.com/,http://foo.com/,http://foo.com/
this could be a triple
(URI http://foo.com/, URI http://foo.com/, URI http://foo.com/)
or
(URI http://foo.com/, URI http://foo.com/, Literal http://foo.com/)
N-Triples adds <> and "" for distinguishing these cases

How to send multiple records in json format

I am creating project in Yii framework. In controller i have function as-
public function actiongetCuriosityQuestionAnswer()
{
$model=new Curiosityquestion;
$json='{"questionId":1}';
$obj=json_decode($json);
$model->questionId=$obj->questionId;
$record=Curiosityquestion::model()->findByPk($model->questionId);
echo "The Question=".$record->question."</br>"."Its answer is-".$record->answer;
echo CJSON::encode($record->answer,$record->question);
}
I want to send question and answer in json format. But "CJSON::encode($record->answer,$record->question);" is sending only answer in json format. i.e. CJSON::_encode is accepting only one parameter. So how to send both question and option in json format together?
Pass your whole object to CJSON::encode, e.g.:
echo CJSON::encode($record);
If you want specific elements, pass as an an array, e.g.:
echo CJSON::encode(array('answer'=>$record->answer, 'question'=>$record->question));
In your javascript, you can access the elements as javascript objects, e.g. data['answer'] or something similar