Question: DLV ASCII Consider a geographical database ( see geo. db in Files / Programs / ) . Note that DLV can be provided with multiple
DLV ASCII
Consider a geographical database see geo. db in FilesPrograms Note that DLV can be provided with multiple input files so you can write your solution in a separate file and feed both files to DLV on the command line. The command line switch nofacts" will omit printing the entire database every time. The database has the schema listed below essentially each predicate is a table in a relational database
statename abbreviation, captial, population, area, orderJoinedUSA,
largestcity, secondlargest third, fourth
citystate stateabbrev, name, population
riverriverName length
riverinriverName state
bordersstate state
highlowstate abreviation, highPlace, height lowPlace, height
mountainstate abreviation, mountainName, height
lakelakeName size
lakeinlakeName state
roadroadName state
Answer the following database queries. One way to surface the answers easily is to write predicates like "partaX : where you define the solution for that part.
a What are the names of rivers that run through Texas?
b Which lakes are in at least two different states?
c Two states are nearby if
i They share a border
ii They share a border with the same state
Find all the states nearby a state containing a city named Kansas City.
d A Symbolic Set in DLV is a syntactic construct Variables : Conjunction that creates a set of all variables that make the conjunction true. Much like in SQL you can apply aggregate functions find the #count, #sum, #times, #min, and #max of the
first variable in the Symbolic Set. For example:
answer C I C #oountN i riverinN "pennsylvanis" river NL L
Counts the number of rivers in Pennsylvania that are longer than miles long the answer is by the wayN : riverinN "pennsylvania" river NL L is a symbolic set representing all the values N that are the names of rivers in PA that are longer than miles long, and #count says to count how many.
Find the number of states that border any state containing the shortest river.
e What is the most populous state with a mountain higher than meters
Note use dlvmingw.exe in Windows to solve
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
