### 24.1 Example model file

Below is a example property list model created with DBModeler, it contains a Model for a library 2 entities, author and book

author contains 2 attributes, authorID the primary key number, and name a string book contains 3 attributes, bookID the primary key number, authorID a foreign key number, and title a string.

author and book each contain a relationship author a to-many relationship to each of the authors books, and book a to-one relationship to the books author for the sake of demonstration i’m ignoring books with multiple authors.

it also contains an adaptor name, and an adaptor specific connection dictionary.

    {
        EOModelVersion = 2;
        adaptorName = SQLite3;
        connectionDictionary = {
    	databasePath = "/tmp/example.db";
        };
        entities = (
    	{
    	    attributes = (
    		{
    		    columnName = authorID;
    		    externalType = integer;
    		    name = authorID;
    		    valueClassName = NSNumber;
    		},
    		{
    		    columnName = name;
    		    externalType = varchar;
    		    name = name;
    		    valueClassName = NSString;
    		}
    	    );
    	    className = EOGenericRecord;
    	    classProperties = (
    		name,
    		toBooks
    	    );
    	    externalName = authors;
    	    name = authors;
    	    primaryKeyAttributes = (
    		authorID
    	    );
    	    relationships = (
    		{
    		    destination = books;
    		    isToMany = Y;
    		    joinSemantic = EOInnerJoin;
    		    joins = (
    			{
    			    destinationAttribute = authorID;
    			    sourceAttribute = authorID;
    			}
    		    );
    		    name = toBooks;
    		}
    	    );
    	},
    	{
    	    attributes = (
    		{
    		    columnName = authorID;
    		    externalType = integer;
    		    name = authorID;
    		    valueClassName = NSNumber;
    		},
    		{
    		    columnName = bookID;
    		    externalType = integer;
    		    name = bookID;
    		    valueClassName = NSNumber;
    		},
    		{
    		    columnName = title;
    		    externalType = varchar;
    		    name = title;
    		    valueClassName = NSString;
    		}
    	    );
    	    className = EOGenericRecord;
    	    classProperties = (
    		title,
    		toAuthor
    	    );
    	    externalName = books;
    	    name = books;
    	    primaryKeyAttributes = (
    		bookID
    	    );
    	    relationships = (
    		{
    		    destination = authors;
    		    isToMany = N;
    		    joinSemantic = EOInnerJoin;
    		    joins = (
    			{
    			    destinationAttribute = authorID;
    			    sourceAttribute = authorID;
    			}
    		    );
    		    name = toAuthor;
    		}
    	    );
    	}
        );
        name = library;
    }