Hi Somebody can Help me with this problem, i need the follow tables in prolog and i need todo some query to this table like the follow.
2.1 Get the plate, number of doors, model, reference and name of the owner
vehicles having a given displacement.
2.2. Get the plate, reference number and owner name doors of the vehicles that
have affiliate contract type and a given model.
2.3. Get the plate, date of revision, ID of the owner of the vehicles with revisions in a
given state and insurer corresponds to a given.
2.4. Get the model plate, ID of owner and contact number of the vehicles with a
and number of gates given speed below a given amount.
2.5. Get the plate, reference, cedula Owners of older vehicles (his model is
lower).
in this paste are the tables
http://pastebin.com/BBue2nFE
please it's somebody can help me Thanks.
Sorry, your posting is hard to understand.
Is your problem that you have data in a relational database and need to access it from Prolog? If so, we need to know which Prolog you are using and which database.
Related
I'm having trouble solving this problem here that was sent to me as an exercise
Create a vehicle registration Rest API to store the vehicles used by the
company. The register must contain the following data:
Name
brand
model
Manufacturing date
Average fuel consumption within the city (KM/L)
Average fuel consumption on highways (KM/L)
Create an API to perform the expense forecast calculation.
It should receive the following information as a parameter:
gasoline price R$
Total km that will be traveled within the city
Total km to be traveled on highways
The return must be a ranked list of company vehicles taking into account
consideration of the amount spent on fuel
I'm having difficulty in how to add an "expense", then calculate this expense according to the variables, associate this expense with the foreign key, and finally show this expense.
This is the database (By the way, it is in Brazilian Portuguese):
car database
expense database
What I managed to do so far in the code was this: https://github.com/LuizMafraJNR/fluigcclean-api-0.0.1
If anyone can really help me, because I'm racking my brains and can't find proper ways to solve this, I'm still learning Spring boot and API creations, so I need someone to enlighten me
I will give an example of entry in the registration of a vehicle
{ "name":"Jetta", "brand":"Volkswagen", "model":"GLI", "dateManufacture":"12/12/2021", "ConsumoMedioCidade":10.9, "ConsumoMedioRodovia":14.7, }
So far so good, but now I want to register a "Spend" on this vehicle that I registered. I made the foreign key already linked to the primary key of the Car class, but I want to understand how to register an expense by selecting the vehicle ID.
After registering this expense in the vehicle I selected, I want to calculate it following these parameters
valorGasto = ((kmRodadosCidade /consumoMedioCidade) + (kmRodadosRodovia/consumoRodovia)) * valorGasolina
The parameter valorGasto is from the database, that is, I want it to take these values from the database, calculate and return in this column and then make an endpoint to show the expense of this vehicle.
I have been stuck on this since May 2020. I don't know how to move forward with the project. Any link or guidance would be very much appreciated. I'm trying to create a very simple rental system.
I have a Customer table: id, Name, Barcode
Another one is Item table: id, Name, Barcode, OnLoan
I'm trying to create a Form where there is a search box for Customer and search box for the Items. When the customer barcode is found and item barcode is found, you can fill in the Date Loaned and Date Due and click submit.
In the Item table, the OnLoan needs to be set to 1.
How do we do this please? Any link or keywords to help me on my way would be really great.
I have been googling and found out about onetomany, manytomany, pivot, scope, repositories. It's very overwhelming, i'm trying to go over them one at a time.
This is kind of an odd situation and I am pretty new to RLS so please forgive me if what I am asking about here might seem a little silly. I am trying to create Row Level Security for a School District. I have a table that has the different schools codes, employee IDs and their position. I have another table that has the employee ID for teachers and their Teacher ID along with the ID if the students they have for the current year with a separate row for each bell period.
I have tried to create a bridge table that contains the Employee ID, Teacher ID as well as the School Codes and connected it with the other two tables.
For testing purposes, I am trying to connect it to the students basic information and set security to see how to give teachers access. I feel like I am almost there but I might be missing something out in here.
Can you please tell me how to go forward from here. Thank you
My application following CQRS strategy separates Read model from Write model. I have a Product and multiple Purchase orders related to that Product.
The PurchaseOrder read model is in Elasticsearch and with product name attached. Now if I change the product name in the write model then I need to update all the PurchaseOrder's productName field accordingly in the read model(using Elasticsearch's bulk update API).
My question is: As I have millions of PurchaseOrders, will this productName sync be a performance issue? Or any suggestions for modeling such kind of syncing?
Although I do not believe that changing a product name on existing orders is a good idea (the invoice might have been generated and the product name in the order should match the one in the invoice), the question still has merit.
You may want your PurchaseOrder to only keep the ID (and perhaps the version?) of the Product, so that you can avoid such a mass update. This approach, on the other hand, requires a call to the Product aggregate root every time you want to translate the ID of the product in its own name. The impact of such a read can obviously be mitigated by using a cache.
I guess it really depend on the number of occurrences of such two circumstances to happen and I would then optimize the most occurring one.
I would like to provide users with points when they do a certain thing. For example:
adding article
adding question
answering question
liking article
etc.
Some of them can have conditions like there are only points for first 3 articles a day, but I think I will handle this directly in my code base.
The problem is what would be a good database design to handle this? I think of 3 tables.
user_activities - in this table I will store event types (I use
laravel so it would probably be the event class name) and points for
specific event.
activity_user - pivot table between user_activities and users.
and of course users table
It is very simple so I am worrying that there are some conditions I haven't thought of, and it would come and bite me in the future.
I think you'll need a forth table that is simply "activities" that is simply a list of the kinds of activities to track. This will have an ID column, and then in your user_activities table include an 'activity_id' to link to that. You'll no doubt have unique information for each kind, for example an activities table may have columns like
ID : unique ID per laravel
ACTIVITY_CODE : short code to use as part of application/business logic
ACTIVITY_NAME : longer name that is for display name like "answered a question"
EVENT : what does the user have to do to trigger the activity award
POINT_VALUE: how many points for this event
etc
If you think that points may change in the future (eg. to encourage certain user activities) then you'll want to track the actual point awarded at the time in the user activities table, or some way to track what the points were at any one time.
While I'm suggesting fourth table, what you really need is more carefully worded list of features to be implemented before doing any design work. My example of allowing for points awarded to change over time is such a feature that you don't mention but you'll need to design for if this feature is needed.
Well I have found this https://laracasts.com/lessons/build-an-activity-feed-in-laravel as very good solution. Hope it helps someone :)