Incorrect value type "#context" in Google Rich Results Test - json-ld

Im pretty new to JSON-LD and am currently struggling making the Google Rich Results Test happy with my custom JSON-LD data.
Every time I use a #context other than https://schema.org/ it shows me the error Incorrect value type "#context".
This even happens with this simple example based on a json-ld.org context:
<script type="application/ld+json">
{
"#context": "https://json-ld.org/contexts/person.jsonld",
"#type": "Person",
"name": "Foo"
}
</script>
After some trail and error I found out that with the following code the json-ld.org/playground shows me the same result if I use #vocab
<script type="application/ld+json">
{
"#context": {"#vocab": "http://xmlns.com/foaf/0.1/"},
"#type": "Person",
"name": "Foo"
}
</script>
And although Google is happy with this code I’m very uncertain if this can or should be the right solution to fix this kind of “Structured data parsing error”?
What is the correct way (that is accepted by Google) to write non-schema.org JSON-LD data?

According to Dan Brickley (Google employee with responsibility for Schema.org) these issues will be addressed or documented for the new validator:
Thanks - noted and acknowledged. The tool is not opensource (it is a view provided by Google's structured data validation infrastructure). I will make sure these issues are addressed or documented before we link the new validator more prominently from Schema.org.
https://github.com/schemaorg/schemaorg/issues/2921#issuecomment-879817283

Related

Client-side fan out data structure

I will implement my fan out model in Google's Firebase, but my question is only theoretical so the answer doesn't need to be in Firebase terms.
I am creating an app that I think should have a data structure similar to Tinder. The idea is only one post shows in your feed at a time; you then accept it or reject it and another one pops up and so on. My question is how exactly to structure the data so that it remains fast when the app scales up.
What I have right now is one node called "Posts" that contains every post that has ever been made. The app then queries for a post which is checked against the user Node of "viewedPosts" so that if the queried post has already been accepted/rejected by the user another one is queried until an unseen one is found. This obviously isn't a great solution because if there are a lot of posts, a query through them will be slow (especially if a lot of them have already been seen and the query has to be repeated multiple times).
I came across this article: The Firebase Blog: Client-side fan-out for data consistency which gave me the idea of creating a node inside each user which is "unseen posts" and every time a new post is uploaded by someone, to put it in the unseen folder for every user. This solves the problem on the side of the viewer, but to upload, one would have to download the list of all users in the app and then write to every single one of them.
So the question is, is there a middle ground between these which I can use to accurately do this?
Thank you.
EDIT:
Someone asked for my data structure:
{
"posts": {
"jkldsahjfkds": {
"title": "Simple Post",
"description": "This is my first post",
"numberOfImages": "2",
"price": "14.99",
"timestamp": "51782345",
"postedBy": "-hjd673bbewi7n",
"name": "Ryan Jacobs"
}
"-nisd7enskwes" : {...}
"-asdjfhk7385i" : {...}
"-sdfh49506ndk" : {...}
}
"users": {
"user1": {
"postsViewed": {
"-nisd7enskwes": 51784645,
"-sdfh49506ndk": 51782329
}
"postsLiked": {
"-sdfh49506ndk": 51782329
}
"userData": {
"name": "Albert Jones",
"bio": "Hi! Jow is everyone doing!?",
"location": "London"
}
}
}
}

Open URL in IBM Watson conversation

I am using a Blumix free account to develop a chat-bot using watson conversation.
How do I add a clickable URL in the response, or automatically call a URL in browser?
I have edited the "advanced response" using the suggestions as described on this page but could not get it work.
How can I achieve that?
I don't know if I understood your question correctly, but.. if you wants add some url inside flows Conversation Service (IBM Watson), try it:
1º: Add the url with tag <a target> and href= your URL inside flows. See the example:
JSON:
"output": {
"text": "This is a link <a target=\"_blank\" href= \"https://www.choosemyplate.gov\">Food and nutrition Guide</a>.\n<br/><br/>Talk to you later, bye for now!"
},
2º See that it did not work inside the Conversation, because it will be your browser that will render the html.
3º If you open with your browser, it works, see:
See that the link is showing up, and this will work for other things in html, like button, for example...
But if you can: based on user input should access a url:
This is done by using two features: Context.request skip_user_input
A request is a special context variable that has args, name and result. It is used to tell the calling app that it should do some action based on this variable.
Setting skip_user_input is optional. In many cases, you might want to execute some business logic in your application and then provide its results via result. Setting skip_user_input to true, will tell Watson Conversation to not wait for input from the user. Thus, your condition on the next node should be based on the content inside result.
{
"output": {},
"context": {
"request": {
"args": {
"url_to_invoke": "your_url"
},
"name": "Call_A_URL",
"result": "context.response"
},
"skip_user_input": true
}
}
Reference: IBM Professional #Dudi: here.

Is including additional information in the output object a good idea?

I'm experimenting with a Conversation where I would like to modify the output in a couple of different ways:
different output for speech or text
different output depending on the tone of the conversation
It looks like I can add extra output details which make it through to the client ok. For example, adding speech alongside text...
{
"output": {
"speech": {
"Hi. Please see my website for details."
},
"link": "http://www.example.com",
"text": {
"Hi. Please see http://www.example.com for details."
}
}
}
For the tone, I wondered about making up a custom selection policy, unfortunately it seems to treat it the same as a random selection policy. For example...
{
"output": {
"text": {
"values": [
"Hello. Please see http://www.example.com for more details.",
"Hi. Please see http://www.example.com for details."
]
},
"append": false,
"selection_policy": "tone"
}
}
I could just add a separate tone-sensitive object to output though so that's not a big problem.
Would there be any issues adding things to output in this way?
You can definitely use the output field to specify custom variables you want your client app to see with the benefit that these variables will not persist across multiple dialog rounds (which they would if you would add them to the context field).
Now currently there is no "easy" way how to define your custom selection policy (apart from the random and sequential supported by the runtime right now) - but you could still return an array of possible answers to the client app with some attribute telling the client app which selection policy to use and you would implement this policy in the client app.

Login application using angularjs

Hi all I am new to Angular, I have to work on login application as of now iam using static json values and my json is given below
{
"records": [
{
"Name": "sudhir",
"Password": "ptg"
},
{
"Name":"manne",
"Password":"ptg123"
}
]
}
Using this Json i have to work on login application so please tell me how to validate this users in my controller if possible give me the answer with code.
Since it looks that your quite new to Angular I would suggest looking at:
http://jasonwatmore.com/post/2015/03/10/AngularJS-User-Registration-and-Login-Example.aspx
https://www.youtube.com/watch?v=C21JNx6hE1w
Or just use any SE. There's plenty of tutorials that will give you a step by step solution to building/validating login form.

A bug in YouTube's API example on GAE? Or am I missing something?

I'm working with this list videos example for GAE and if you try to run it on that page you can see that there's no next_page_token
I've even tried to self.response.out.write(next_page_token) and got None.
For example purposes I've submitted Channel name to be Google (which surely has more than 50 videos). I only get 50, no token that I can see, no pagination indication or anything like that.
What am I missing here?
Please advise,
Thanks a lot
Here is the first request pre-filled for you. Click execute at the bottom:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails&forUsername=Google&_h=1&
Following that result and hitting the next api in the code,
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&maxResults=50&playlistId=UUK8sQmJBp8GCxrOtXWBpyEA&_h=3&
Clicking execute on that shows that nextPageToken set. Either the code example from Google has a bug in it, or it is a copy paste error somewhere.
EDIT:
There is a bug in the code sample provided.
playlistitems_response looks similar to this:
{
"kind": "youtube#playlistItemListResponse",
"etag": "\"eYE31WLho912TfxEBDDRSwEQ5Ms/vUtg-sAFafmsExy-5XOvaMIfVN0\"",
"nextPageToken": "CDQQAA",
"prevPageToken": "CDIQAQ",
"pageInfo": {
"totalResults": 1634,
"resultsPerPage": 2
},
"items": [{...}]
}
The nextPageToken is being extracted like playlistitems_response.get('tokenPagination', {}).get('nextPageToken') when it
should read playlistitems_response.get('nextPageToken').

Resources