GithubHelp home page GithubHelp logo

cosmicmind / graph Goto Github PK

View Code? Open in Web Editor NEW
872.0 34.0 79.0 32.96 MB

Graph is a semantic database that is used to create data-driven applications.

Home Page: http://cosmicmind.com

License: MIT License

Swift 99.43% Ruby 0.16% Objective-C 0.40%
coredata data database graph graph-theory data-driven data-driven-design data-driven-workflows semantic-database icloud

graph's Introduction

Graph

Welcome to Graph

Graph is a semantic database that is used to create data-driven applications.

Material Sample

Features

  • iCloud Support
  • Multi Local & Cloud Graphs
  • Thread Safe
  • Store Any Data Type, Including Binary Data
  • Relationship Modeling
  • Action Modeling For Analytics
  • Model With Graph Theory and Set Theory
  • Asynchronous / Synchronous Search
  • Asynchronous / Synchronous Saving
  • Data-Driven Architecture
  • Data Model Observation
  • Comprehensive Unit Test Coverage
  • Example Projects

Requirements

  • iOS 8.0+ / Mac OS X 10.10+
  • Xcode 8.0+

Communication

  • If you need help, use Stack Overflow. (Tag 'cosmicmind')
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

Embedded frameworks require a minimum deployment target of iOS 8.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Graph's core features into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Graph', '~> 3.1.0'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Graph into your Xcode project using Carthage, specify it in your Cartfile:

github "CosmicMind/Graph"

Run carthage update to build the framework and drag the built Graph.framework into your Xcode project.

Changelog

Graph is a growing project and will encounter changes throughout its development. It is recommended that the Changelog be reviewed prior to updating versions.

Samples

The following are samples to see how Graph may be used within your applications.

  • Visit the Samples repo to see example projects using Graph.

Creating an Entity for an ImageCard

An Entity is a model (data) object that represents a person, place, or thing. It may store property values, be a member of groups, and can be tagged.

In the following example, we create an ImageCard view using Material and populate it's properties with an Entity that stores the data for that view.

Material ImageCard

Creating data

let graph = Graph()

let entity = Entity(type: "ImageCard")
entity["title"] = "Graph"
entity["detail"] = "Build Data-Driven Software"
entity["content"] = "Graph is a semantic database that is used to create data-driven applications."
entity["author"] = "CosmicMind"
entity["image"] = UIImage.load(contentsOfFile: "frontier", ofType: "jpg")

graph.sync()

Setting the view's properties

imageCard.toolbar?.title = entity["title"] as? String
imageCard.toolbar?.detail = entity["detail"] as? String
imageCard.imageView?.image = entity["image"] as? UIImage

let contentLabel = UILabel()
contentLabel.text = entity["content"] as? String
imageCard.contentView = contentLabel

let authorLabel = UILabel()
authorLabel.text = entity["author"] as? String
imageCard.bottomBar?.centerViews = [authorLabel]

Searching a list of users in realtime

Using the Search API is incredibly flexible. In the following example, Search is used to create a live search on user names with a dynamic UI provided by Material's SearchBar.

Material SearchBar

Preparing the search criteria

let graph = Graph()

let search = Search<Entity>(graph: graph).for(types: "User").where(properties: "name")

Asynchronously searching graph

search.async { [weak self, pattern = pattern] (users) in

	guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else {
	    return
    }

	var data = [Entity]()

	for user in users {
		if let name = user["name"] as? String {
			let matches = regex.matches(in: name, range: NSRange(location: 0, length: name.utf16.count))

			if 0 < matches.count {
				data.append(user)
			}
		}
	}

	self?.tableView.data = data
}

License

The MIT License (MIT)

Copyright (C) 2019, CosmicMind, Inc. http://cosmicmind.com. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

graph's People

Contributors

adam88labs avatar adamnemecek avatar danieldahan avatar michaelreyder avatar mohpor avatar ninjaishere avatar orkhanalikhanov avatar rickw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graph's Issues

Enhance Search

  • Allow Type to property and group values
  • order by values

Protocol-oriented expected

Great job. However, the interface with so many classes are a bit hard to understand the structure and relationship, for beginners.

Also from match-perspective, someone, like myself, expect a Swift framework that present Graph with its match abstraction, and focus on graph math operations and algorithms. Rather than, this seems to me more CoreData/storage focused.

Could you please consider this as new features for GraphKit? Thanks

Line Chart Crashes if it only has equal values for a line

I have a chart with a single line
I set startFromZero as true
I set data values to [0,0]

you then get

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [20 nan]'

Caused by

  • (CGFloat)_positionYForLineValue:(CGFloat)value {
    CGFloat scale = (value - [self _minValue]) / ([self _maxValue] - [self _minValue]);

because ([self _maxValue] - [self _minValue]) == 0

Best way of searching entity.

Hi, first off, I would like to say that I love the concept. I've been using it for a few days and I would like to ask if there is an optimized way that you'd recommend for searching for a specific entity with a specific property. I've been time profiling the app I'm using and for comparing 350 entities that already exist in the Graph, its taking roughly 10 seconds.

Xcode 6.2 and iOS 8.2 compatibility

Apple just released their new public versions of Xcode and iOS. Can you please update your library / pod to support the latest release. Thanks.

Maybe a bug, But more likely something im doing wrong

private func internalSelect(x: RedBlackNode<Key, Value>, order: Int) -> RedBlackNode<Key, Value> {
    validateOrder(order)
    var r: Int = x.left.order + 1
    if order == r {
        return x
    } else if order < r {
        return internalSelect(x.left, order: order)
    }
    return internalSelect(x.right, order: order - r)
}

I keep getting " fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb) "

Seems to happen after hitting this line of code in my project
var randomWordFromWords = graph.search(Entity: "Word")[randomNumber()]

screen shot 2015-09-03 at 10 59 02 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.