logic,semantics,semantic-web,first-order-logic , Describe a film (entity and attribute) using the first order logic

Describe a film (entity and attribute) using the first order logic


Tag: logic,semantics,semantic-web,first-order-logic

Good morning, I want to understand how can I describe something using the first order logic.

For example I want to describe what is a film (an entity) and what is an attribute (for example actor: Clooney) for the film. How can I describe that using the first order logic?

******* UPDATE ********

What I need to explain in first logic order is:

ENTITY: an element, an abstraction or an object that can be described with a set of properties or attributes. So I think that I must says that the entity has got a set of attributes with their respective values. An Entity describes an element, an abstraction or an object.

ATTRIBUTE: an attribute has always got a value and it always associated to an entity. It describes a specific feature/property of the entity.

DOCUMENT: a pure text description (pure text it not contains any html tags). Every document describes only ONE entity through its attribute.


To state that an object has a certain property you would use a single place predicate. For example, to state that x is a film you could write Film(x). If you want to attribute some value to an object you can use two (or more) place predicate. Using your example you could say that Clooney starred in a film as Starred(clooney, x).

There are certain conventions that people use. For example, predicates start with capital letters (Actor, Film, FatherOf) and constants start with a lower case letter (x, clooney, batman). Constants denote objects and predicates say something about the objects. In case of predicates with more than one argument the first argument is usually the subject about which you are making the statement. That way you can naturally read the logical formula as a sentence in normal language. For example, FatherOf(x, y) would read as "x is the father of y".

Answer for the update:

I am not sure whether you can do that in first order logic. You could describe an Entity as something that has certain properties by formula such as

\forall x (Entity(x) ==> Object(x) | Element(x) | Abstraction(x))

This is a bit more difficult for the Attribute. In first order logic an attribute ascribes some quality to an object or relates it to another object. You could probably use a three place predicate as in:

\forall attribute (\exists object (\exists value (Has(object, attribute, value))))

As to the document, that would be just a conjunction of such statements. For example, the description of George Clooney could be the following:

Entity(clooney) & Has(clooney, starred, gravity) & Has(clooney, bornIn, lexington) & ...


What's this Coffescript use of then?

In Trevor Burnham's book on Coffeescript (p81) he has newcard.save().then => ... Which is not part of a conditional or a switch statement. Is then just a joining word for the syntax or does it have a semantic purpose?...

Logical Operators and Precedence

So I just did some random test and understand the fundamentals of Precedence and the || and or operators but I'm having trouble understanding why $f changes: $f = 0 || 1; if ($f === 1){ echo "TRUE - $f"; }else{ echo "FALSE - $f"; } $f = 0 or...

How is the manipulation is done on bit level?

Assume that the size of char is 1 byte and negatives are stored in 2's complement form #include<stdio.h> int main() { char c = 125; c = c+10; printf("%d", c); return 0; } How can be the answer is -121?...

Formatting decimal places with unknown number

I'm printing out a number whose value I don't know. In most cases the number is whole or has a trailing .5. In some cases the number ends in .25 or .75, and very rarely the number goes to the thousandths place. How do I specifically detect that last case?...

How do I get my logic in this Java program to make my loop work?

I've made this java program to find the two smallest integers as inputted by the user. I think I'm pretty much just about there except there is one issue with my logic. I'm not sure what to set values: int min, min2; to where the rest of my program would...

Unix - Tail Utility would open the file or not

Can anybody help me to sort this out. What is the logic of Tail -f utility in Unix. Is it open the log file to check the updated content or is there any other way to get this information. All the implimentation of Tail utility says that it will open...

button click issue in Ext js

i have small query i created four text fields and one button,in text fields i gave property allowblank:true if user enter shows error message,it's working perfect.If the click the button the inserted perfect,after that the textboxes becomes empty it's showing blank errormessage.If iam using Allowblank:false it's working fine.but i require...

What's the difference between if(A) then if(B) and if (A and B)?

if(A) then if(B) vs if(A and B) Which is better to use and why ?...

Parse JSON on PHP and extract the particular value(s)

Objective: To parse following json string and get mentioned values separately, later those separated values are going to be inserted to mysql database. I have checked my json string on JsonLint user_name, selected_date, selected_project, tasks , 4.1.task_name, 4.2 work_hours { "user_name": "USER", "selected_date": "2015-06-08", "selected_project": "Project1", "tasks": [ { "task_name":...

Project Euler Solution 8, Explanation needed

I have resolved the Problem 8 of Project Euler; The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866...

Developing a Checkers (Draughts) engine, how to begin?

I'm a relatively inexperienced programmer, and recently I've been getting interested in making a Checkers game app for a school project. I'm not sure where I can start (or if I should even attempt) at creating this. The project I have in mind probably wouldn't involve much more than a...

Consequence of restrictions in ontology on SPARQL end results

I am concerned about two classes (SensingDevice and Property) of my ontology (dgo.owl) as shown in the below figure. These two classes are connected by observes property: and the related ontology portion is as: <owl:Class rdf:about="http://www.iiitd.edu.in/~haroonr/ontologies/DGO#TemperatureSensor_Livingroom"> <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#SensingDevice"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observes"/>...

MarkLogic 8 - SPARQL - Follow synonym chain

Let's say I have lots of ontologies with synonyms. <term> <word>cat</word> <synonyms> <synonym>feline</synonym> </synonyms> </term> <term> <word>feline></word> <synonyms> <synonym>kitty</synonym> <synonyms> </term> How can I write a SPARQL query such that I can give it the word cat and it will give me all the synonyms of cat as well as...

HTML - How to properly mark a phrase

The <blockquote> tag demand a cite external source, but what if the only source is the name of the phrase author? The <cite> tag defines the name of a work (e.g. a book, a song, a movie, a TV show, a painting, a sculpture, etc.), so it's no suitable to...

Configuring inputs for a Multiple Input Fuzzy Controller in Labview?

I'm building a fuzzy controller in Labview using the MIMO (Multiple Input, Multiple Output) FL Fuzzy Controller.vi. I designed the fuzzy system using the Fuzzy System Designer, and the .fs file is connected as the "fuzzy system in" of the MIMO Fuzzy Controller VI. The input values are where I'm...

Validate user's input

I have 3 text boxes: textbox1, textbox2, textbox3. Users only allow to fill out information in one text box. private string determineSearchParameter() { //Execute statements if ALL textboxes are empty if (string.IsNullOrWhiteSpace(textbox1.Text) && string.IsNullOrWhiteSpace(textbox2.Text) && string.IsNullOrWhiteSpace(textbox3.Text)) { return "Please Enter a Search Parameter"; } //Execute all fields have an input...

Python: get maximum value object for unique key

I have the following list of items: [ {'country' : 'India', 'date' : '18-Mar-14'}, {'country' : 'India', 'date' : '18-Apr-14'}, {'country' : 'India', 'date' : '18-May-14'}, {'country' : 'Australia', 'date' : '18-Mar-14'}, {'country' : 'Australia', 'date' : '18-Apr-14'}, {'country' : 'Australia', 'date' : '18-May-14'}, {'country' : 'China', 'date' : '18-Mar-14'},...

SQL/C# book a trip for customers

I'm trying to make a VERY simple application to let customers book a trip. Basically, they enter Name, Address, Civic, Phone and then a number between 1-5 depending on which trip they want to book. So for example trip 1 equals a trip from Berlin to Paris, trip 2 from...

How to use logical functions with %>% operator (dplyr)

I was wondering how to use logical (for example which, any, all) functions with %>% operator from dplyr package in R. I have a vector of values aaa <- sample(1:5, 10, replace = TRUE) I would like to find out which of them are equal to 4. When I try...

Python is returning false to “1”==“1”. Any ideas why?

I've written a scout system for my A Level computing task. The program is designed to store information on scouts at a scout hut, including badges, have a leaderboard system, and a management system for adding/finding/deleting scouts from the list. The scout information MUST be stored in a file. File...

How to check a time array if the single values are in +/- 15 minute range of another time

What should I do to make a 4 digit integer/string to behave (not look) like time? Consider this code: $t = 0430; $timeArray = array('0400', '0415', '0420', '0430', '0440', '0450', '0500', '0600'); Now if I have to search $timeArray for elements which are +/- 15 min from $t I would...

Player Movement Direction Logic

Consider points A and B as walls and point O as player inside walls. So they look like A O B. I want player to move left when he touches rightPoint B. And move right when he touches leftPoint A. The screen is being rendered and player position is either...

horizontal movement in game (rotated player)

In my world I have a character wich is always rotated towards the mouse. It is very logical that when the player moves forward or backward, that the character's x coordinate equals it's x coordinate minus (or plus) the cosine of its x coordinate. And the same for its y...

Calculate the score of the game “GO”

Does anyone know how to calculate the score in the game of Go programmatically? I have an array of 19x19 and each element of this array can be 0 (empty point), 1 (black stone) or 2 (white stone). I don't understand how can I check the region to belong to...

OWL. How to express that siblings has common parent?

I wrote simple file in turtle notation where Dave is father of Mary and Mary sister of Jack. I want reason that Dave have two childs Jack and Mary. :Human a rdfs:Class . :Man rdfs:subClassOf :Human ; owl:disjointWith :Woman . :Woman rdfs:subClassOf :Human ; owl:disjointWith :Man . :hasChild a rdf:Property...

File Reader Method

So I wrote this file reader method that should return a string of everything that is in the file, but it isn't working properly. Writing into the file works perfectly, but this reading method doesn't. What the method does currently is it reads the last string/text added, but it does...

“.use” method to add logic on each request of SuperAgent

This issue in SuperAgent repository mentions the .use method to add logic on each request. For example, adding an Authorization header for JWT when a token is available: superagent.use( bearer ); function bearer ( request ) { var token = sessionStorage.get( 'token' ); if ( token ) request.set( 'Authorization', 'Bearer...

didBeginContact logic OSX swift

I am having some trouble with the logic inside of didBeginContact on an OSX game i'm creating. It is written in swift, here is what the code currently is: func didBeginContact(contact: SKPhysicsContact) { let collision: UInt32 = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask if collision == PhysicsCategory.player | PhysicsCategory.wall { } else if...

How does this code print odd and even?

#define MACRO(num, str) {\ printf("%d", num);\ printf(" is");\ printf(" %s number", str);\ printf("\n");\ } int main(void) { int num; printf("Enter a number: "); scanf("%d", &num); if (num & 1) { MACRO(num, "Odd"); } else { MACRO(num, "Even"); } return 0; } Please explain the above code (if/else condition and how...

Date modelling using ontology concepts

Problem: I need to create an ontology (say www.example.com/ontology/ont# , with ONT prefix). This ontology consists of some other ontologies with prefixes as SSN, TIME, GEO, etc. Now, the confusion is that when I use ONT ontology for data modelling, should I use original prefix’s such as SSN,TIME and GEO...

Virtuoso 37000 Error SP030

why is showing this error, i see in the sparql query is correct, i don't see any mistake in prefix. PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX type: <http://dbpedia.org/class/yago/> PREFIX prop: <http://dbpedia.org/property/> SELECT ?country_name ?population WHERE { ?country rdf:type dbpedia-owl:Country; rdfs:label ?country_name ; prop:populationEstimate ?population . FILTER (?population > 2334456) . FILTER ( lang(?country_name)...

Buffered Writer and Reader Proper order/use

So I'm not sure where my mistake is in the order/use of BufferedWriter and BufferedReader. See for yourself. My program works all except for these methods. Here is where I declared stuff, pretty sure error is not here. fw = new FileWriter(file, true); bw = new BufferedWriter(fw); fr = new...

How to allow more entry and return factors for Prime Checker [Java]?

I set out to write a Prime Number Checker: import java.util.Scanner; public class PrimeChecker { int userEntry; int even_check; int odd_check; final void run(String[] args) { Scanner jaiho = new Scanner(System.in); System.out.printf("Please enter a prime number: %n"); userEntry = jaiho.nextInt(); even_check = userEntry % 2; // This is to get...

Organize table avoiding redundancy

I'm trying to create a database to manage autobus data CREATE TABLE Company( Company_Name VARCHAR(12), Tel INT, PRIMARY KEY(Company_Name) ); CREATE TABLE Line( ID_Line VARCHAR(3), NCompany_Name VARCHAR(12), Desc TEXT, PRIMARY KEY(ID_Line, Company_Name), FOREIGN KEY (Company_Name) REFERENCES Company(Company_Name) ); CREATE TABLE Stop( ID_Stop VARCHAR(3), geoLat FLOAT(10,6), geoLong FLOAT(10,6), PRIMARY KEY(ID_Stop) );...

Backwards Chaining With Variables

I have been reading up about inference in Prolog/Datalog and while forward chaining seems fairly simple to grasp, I have some issues with backward chaining with any sort of complex example which isn't simply propositional or used to determine a true or false value. I was reading an article the...

PHP: Switch() If{} other control structures [closed]

How do you execute logic with out the use of Switch or If? For instance check_id_switch($id) function check_id_switch($id){ switch($id){ case '1': $HW = 'Hello, World!'; break; default: $HW = 'Goodbye, World!'; break; } return $HW; } Or instance check_id_if($id) function check_id_if($id){ if($id == 1){ $HW = 'Hello, World!'; } else{...

Please help create code to calculate the percent of clicks on the button

I am a novice developer. Please help to create the code to count clicks on the buttons (on Android). I have three ImageButton (IB1, IB2, IB3) and I have 3 empty TextView (TV1,TV2, TV3). However, the counter should not be considered the number of clicks each of the three buttons....

>= not working, R [duplicate]

This question already has an answer here: Why are these numbers not equal? 3 answers I am running the code below. The function Ax returtns the value 1. But the ifelse statement does not recognize that Ax==1. I've tried making the output of the function double-precision and all numeric...

PHP logic to add a class to 2 rows every other 2 rows

Can anyone help me with the logic to add a class .col-md-offset-2 to every two rows in my code below... <?php while(have_rows('report_quotes')): the_row(); ?> <div class="col-md-12 <?php // help me ?>"> <?php /* quote */ ?> <?php Post::get_template_part('sections/quote'); ?> </div> <?php endwhile; ?> So the output will look like this......

Mathmatical expressions in pseudo code

I have pseudo code am trying to implement in python but I cant seem to remember what p ← 0 would mean in logic or calculus. Thanks in advance

How to extract business logic in this example

The following method filters a data collection based on order statuses. Im wondering what would be the best way to extract the business logic held within about the order statuses. For example, say the order statuses were to change down the line i.e. ('in_transit', 'at_courier') then this method, and associated...

Calculating number of nights in overlapping dates

I'm having an issue figuring out a logical way to solve this problem. I have a list of date ranges, say for example: 01/01/15 - 11/01/15 02/01/15 - 04/01/15 09/01/15 - 13/01/15 18/01/15 - 20/01/15 What I need to do is figure out the total number of nights covered over...

Logic synthesis from an arbitary piece of code

I have completed on a project making physical logic gates and am now looking for a way to turn an arbitrary program into some series of logic gates so I can use them. I need a program that can take some arbitrary function (say f= x^2 -1) directly into some...

if and else if do the same thing

I'm trying to refactor an if-else chain that doesn't look particularly good. My common sense is telling me that I should be able to call my method only once but I can't figure out an elegant way to do it. Currently what I have is: if(condition1) do method1; else if(condition2)...

Object Variables in Ruby

I'm learning Ruby and I found this code example on book, it's about encapsulation. Here it: class Person def initialize(name) set_name(name) end def name @first_name + " "+ @last_name end def set_name(name) first_name, last_name = name.split(/\s+/) set_first_name(first_name) set_last_name(last_name) end def set_first_name(name) @first_name = name end def set_last_name(name) @last_name = name...

How do I format the logic for 3 conditions and use a previous condition as well?

NOT ASKING FOR ANYONE TO WRITE THE PROGRAM FOR ME I am having trouble understanding how to setup the logic for a program given these following conditions: For every day late up to and including 7 days, the late fee is $0.10/day After 7 days, for every day late up...

How to minimize the use of if else if in XMLStreamReader while parsing complex XML

I have the sample XML data below which I want to convert to a simple XML form. I have to create multiple XML data based in the occurrence of certain element-value in the main XML data. The logic is embedded inside a XMLStreamReader. While doing that I have to use...

Why can an instance of a class access private fields of another instance of its own type?

An instance of a class, in Java, can access private fields of a different instance of its own type, such as in the following listing: public class Foo { private int secret; public void bar(final Foo foo) { foo.secret = 100; } } What would be the argument for such...

How to add repeating occurences of elements in two lists in python

I have filtered_symbolic_path = ['A', 'B', 'C', 'D', 'B', 'C'] filtered_symbolic_path_times = [ 3, 4, 5, 6, 5, 3] Here, A=3, B=4 ,C=5, D =6, B=5. C=3 I want a dictionary like, time_per_screen{A:3,B:9,C:8,D:6} ...

What is the semantic HTML tag to display for URLs that are not links?

I have a search engine plugin that outputs results in a basic structure: <a href="page url"> <div class="searchResult"> <h3>Page title</h3> <p>Page url</p> <p>Page <meta> description</p> </div> </a> The plugin is designed to integrate into an existing website so it has no default styling. However, websites are supposed to be usable...