I am trying to understand how to define schema Brand on a brand page.
Using the example of a website selling shoes, apart from category pages, there will be brand pages listing all products (they link out to their respective product page) of the respective brand. So, at a high level what I figure will be an approach like this:
- schema: CollectionPage, defining the WebPage
- schema: Brand, connected to CollectionPage using `mainEntityOfPage`
- schema: ItemList, list of the brand's products displayed
In the above, I am not able to connect the ItemList to Brand, so it's hanging (Google SDTT is showing 2 independent schemas on the page).
There's another option, where we connect the ItemList to CollectionPage using mainEntityOfPage but then Brand will be hanging.
Is there some way to connect all the 3 schemas?
If not, are there alternate methods of defining the 3 things so that we can connect them?
A point to note here is that both Brand and ItemList has name property and they hold the same values, but that doesn't connect them, as I understand.
Any insight into this will help.
use these combinations
Brand/subjectOf/WebPage
Product/brand/Brand
ItemList/itemListElement/Product
linked using the relevant #id
Related
i am building a small web app with MERN, i have a collection that holds "name, email, password, avatar url, and date" and i am going to add to the users some info like a "bio, hobbies(array), "visited countries(array), and another array"
question is, should i create a diffrent model for the users info, and add owner field that refers to the other model?. or should i put all of them there,
also i might add the following and followers option in the future.
The user's info should be in the user collection, I could see there is no reason to have a separate collection for it. If you want to reduce the responses from listing users, you could use populate to remove unnecessary fields.
Regards to the following and followers, I think there are 2 approaches:
Adding a new field which used to store id and necessary metadata (name, avatar) of users to the existing collection
Create a new collection which is a combination of users and users they are following, or are followed. You then could use Virtual to get this information from the User collection.
Personally, I prefer the first approach although it requires more effort to maintain the list to be accurate. E.g remove an item out of the list when your follower stops following you.
In the admin page of your Directus CMS you can see, when using a M2M and related O2M relation the number of records in the relation. I would like to display, using vuejs, that cardinality next to the category field and hide the categories with no relation yet.
Any idea on this ?
Well,
It looks as it goes like this
https://api........./items/blog_categories?meta=total_count&result_count&fields=*.*
So nothing more...and the meta can be omitted as it won't matter in the context of my question.
With MongoDb how can I restrict access to documents - based on user defined groups?
The scenario is a social app like a blog where users create content and others can comment on it. But I need to allow the content creators to be able to limit access to content (posts) based on specific groups they define (eg Public, Family, Work, Private) where each group also has an access level eg none/read/write.
I'm fairly new to MongoDB/NoSQL. In a relational db sense I would simply create a join table (linking the many-to-many relationship between user-groups and posts then use an inner join when querying the data.
Thanks.
I want to achieve the following using Apache Wicket.
We have the requirement that the URL /xxxx can display one of two things.
If there is an entry in the "city" table (column "url_name") then we should display the CityDetailPage.
If there is an entry in the "venue" table (column "url_name") then we should display the VenueDetailPage.
These are quite distinct pages, with hundreds of lines of various wicket components and so on.
Currently we had two different URLs (/city/xxx and /venue/xxx) and they were mapped in the application, and that worked fine. Now they should share a URL.
I need to have some kind of logic like "select id from city where url_name=?" and if there is a row display the CityDetailPage, else if "select id from venue where url_name=?" then VenueDetailPage, otherwise 404.
Things I've considered:
Have one huge page with two sections which are visible/invisible based on what's found. But that's quite inelegant, these are two different pages basically.
Have a Servlet which looks at the path and does the db query then an internal redirect (we have Apache in front of our Servlet engine). Also feels inelegant, it's outside wicket.
Maybe some Page which does nothing more than some kind of wicket exception which displays another page (but does not alter the URL), not sure which type to use?
Thanks in advance! I am quite stuck :(
I'd recommend to use custom IProvider, i.e. instead of mountPage("the/path", VenuePage.class) do mount(new MountedMapper("the/path", new MyClassProvider())), where MyClassProvider implements IProvider and returns different page class in #get() depending on your conditions.
Given the following tables: User, Trial, UserTrial. Where A user has multiple trials, a Trial does not internally map to any Users and contains details about the trial (name, description, settings), and a UserTrial contains information specific to an instance of a User's trial (expiration date, for example). What would be the proper way for the controller of an MVC application to access data about a UserTrial?
Additional Details
There is no ORM
Each class is dual-purposed to be useable to create new, or load existing Users, Trials, or UserTrials. The constructor loads data when passed an ID and persists it with the method ->save()
It would seem that there are 2 options:
1
User.SetTrial()
User.GetUserTrial()
2
UserTrial.SetUser()
UserTrial.SetTrial()
UserTrial.GetSomeData()
Which is the most appropriate usage?
I don't think your option 1 will work because if each User can have multiple Trials, then you'd need something like User.AddTrial(Trial), User.RemoveTrial(Trial), User.getUserTrails().
Which design option you choose depends on whether you want to make UserTrial objects "first class" or not. Do you want to consider Users and Trials to be the primary objects with UserTrial objects just glue to hold the relations, or do you want UserTrial objects to be primary as well? If the former, you'll want something like your option 1; if the latter, you'll want something like your option 2.