Geospatial Graphs made easy with OrientDB - Luigi Dell'Aquila - Codemotion Mi...Codemotion
Modeling and querying persistent data structures can be tricky when they involve semi-structured data, complex relationships (with deep traversal) and physical information like geographical positions, areas, shapes and so on. Bad news is that almost all your applications will have to manage such kind of data. In this presentation we will see how to use OrientDB v2.2 Document-Graph engine and its new Geospatial Indexes to efficiently manage ad query connected, spatial information. Very few slides, a lot of live coding, I promise!
These are the slides of the talk, that I gave at the University of Jena on 2016.03.09.
I talked about SQL and why it was always important for Zalando Technology. How we have build one of the biggest PostgreSQL installations in the world and how ZalandoTech is giving back to the community by contributing to the Open Source projects
Geospatial Graphs made easy with OrientDB - Luigi Dell'Aquila - Codemotion Mi...Codemotion
Modeling and querying persistent data structures can be tricky when they involve semi-structured data, complex relationships (with deep traversal) and physical information like geographical positions, areas, shapes and so on. Bad news is that almost all your applications will have to manage such kind of data. In this presentation we will see how to use OrientDB v2.2 Document-Graph engine and its new Geospatial Indexes to efficiently manage ad query connected, spatial information. Very few slides, a lot of live coding, I promise!
These are the slides of the talk, that I gave at the University of Jena on 2016.03.09.
I talked about SQL and why it was always important for Zalando Technology. How we have build one of the biggest PostgreSQL installations in the world and how ZalandoTech is giving back to the community by contributing to the Open Source projects
Codemotion akka persistence, cqrs%2 fes y otras siglas del montónJavier Santos Paniego
¿Qué me dices?¿Que puedo separar la parte de acciones de las vistas de mi aplicación?¿Que además puedo hacerlo escalable usando Akka-persistence?¿Basado en eventos?
En esta charla, el equipo de Scalera esperamos enseñaros cómo funciona la aproximación CQRS (recientemente implantada en sistemas como Lagom de Lightbend) para crear aplicaciones altamente escalables y resilient, usando Akka persistence como herramienta para poder guardar el estado de tu aplicación de manera distribuida y basada en eventos.
Si no te ha sonado a anuncio de tele-tienda pasivo-agresivo y aún te quedan ganas de descubrir que significan todas estas siglas raras, esta es tu charla.
Apache Spark is already a proven leader as a heavy-weight distributed processing framework. But how does one migrate an 8-years-old, single-server, MySQL-based legacy system to such new shiny frameworks? How do you accurately preserve the behavior of a system consuming Terabytes of data every day, hiding numerous undocumented implicit gotchas and changing constantly, while shifting to brand new development paradigms? In this talk we present Kenshoo’s attempt at this challenge, where we migrated a legacy aggregation system to Spark. Our solutions include heavy usage of metrics and graphite for analyzing production data; “local-mode” client enabling reuse of legacy tests suits; data validations using side-by-side execution; and maximum reuse of code through refactoring and composition. Some of these solutions use Spark-specific characteristics and features.
As the de facto standard for large-scale data processing in the Java world, Apache Spark is the logical choice when you want to investigate big data processing. As a matter of fact, most resources online refer to the Scala API that is exposed by Spark. What to do if you and your company are much more comfortable with Java than the Scala language? These slides give pointers whether it makes sense to learn and introduce an entirely new language just for your big data processing.
Introduction to interactive data visualisation using R Shinyanamarisaguedes
Shiny is an R library for building interactive webapps. Shiny allows rapid prototyping and quick production of dashboards and interactive data visualisations. This is especially important in situations where putting a real data-driven prototype in the hands of the end user allows for better refining of requirements before passing off to a web development team. This allows to speed up the delivery process and reducing the dependencies on other teams.
Code and solution to exercises available on github: https://github.com/amguedes/ShinySeminar
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
In this talk, I explain how to use CouchDB mobile to connect your iPhone or Android phone with a a remote ChouchDB to build a RunKeeper clone. The code for this talk is available at https://github.com/peterfriese/CouchTo5K
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences. For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely. This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
WildFly 8 application server
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
JavaCro 2014 Scala and Java EE 7 Development ExperiencesPeter Pilgrim
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences.
For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely.
This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
What SQL functionality was added in the past year or so. The presentation covers default expressions, functional key parts, lateral derived tables, CHECK constraints, JSON and spatial improvements. Also some other small SQL and other improvements.
Solutions for bi-directional Integration between Oracle RDMBS & Apache KafkaGuido Schmutz
A Kafka cluster stores streams of records (messages) in categories called topics. It is the architectural backbone for integrating streaming data with a Data Lake, Microservices and Stream Processing. Today’s enterprises have their core systems often implemented on top of relational databases, such as the Oracle RDBMS. Implementing a new solution supporting the digital strategy using Kafka and the ecosystem can not always be done completely separate from the traditional legacy solutions. Often streaming data has to be enriched with state data which is held in an RDBMS of a legacy application. It’s important to cache this data in the stream processing solution, so that It can be efficiently joined to the data stream. But how do we make sure that the cache is kept up-to-date, if the source data changes? We can either poll for changes from Kafka using Kafka Connect or let the RDBMS push the data changes to Kafka. But what about writing data back to the legacy application, i.e. an anomaly is detected inside the stream processing solution which should trigger an action inside the legacy application. Using Kafka Connect we can write to a database table or view, which could trigger the action. But this not always the best option. If you have an Oracle RDBMS, there are many other ways to integrate the database with Kafka, such as Advanced Queueing (message broker in the database), CDC through Golden Gate or Debezium, Oracle REST Database Service (ORDS) and more. In this session, we present various blueprints for integrating an Oracle RDBMS with Apache Kafka in both directions and discuss how these blueprints can be implemented using the products mentioned before.
Codemotion akka persistence, cqrs%2 fes y otras siglas del montónJavier Santos Paniego
¿Qué me dices?¿Que puedo separar la parte de acciones de las vistas de mi aplicación?¿Que además puedo hacerlo escalable usando Akka-persistence?¿Basado en eventos?
En esta charla, el equipo de Scalera esperamos enseñaros cómo funciona la aproximación CQRS (recientemente implantada en sistemas como Lagom de Lightbend) para crear aplicaciones altamente escalables y resilient, usando Akka persistence como herramienta para poder guardar el estado de tu aplicación de manera distribuida y basada en eventos.
Si no te ha sonado a anuncio de tele-tienda pasivo-agresivo y aún te quedan ganas de descubrir que significan todas estas siglas raras, esta es tu charla.
Apache Spark is already a proven leader as a heavy-weight distributed processing framework. But how does one migrate an 8-years-old, single-server, MySQL-based legacy system to such new shiny frameworks? How do you accurately preserve the behavior of a system consuming Terabytes of data every day, hiding numerous undocumented implicit gotchas and changing constantly, while shifting to brand new development paradigms? In this talk we present Kenshoo’s attempt at this challenge, where we migrated a legacy aggregation system to Spark. Our solutions include heavy usage of metrics and graphite for analyzing production data; “local-mode” client enabling reuse of legacy tests suits; data validations using side-by-side execution; and maximum reuse of code through refactoring and composition. Some of these solutions use Spark-specific characteristics and features.
As the de facto standard for large-scale data processing in the Java world, Apache Spark is the logical choice when you want to investigate big data processing. As a matter of fact, most resources online refer to the Scala API that is exposed by Spark. What to do if you and your company are much more comfortable with Java than the Scala language? These slides give pointers whether it makes sense to learn and introduce an entirely new language just for your big data processing.
Introduction to interactive data visualisation using R Shinyanamarisaguedes
Shiny is an R library for building interactive webapps. Shiny allows rapid prototyping and quick production of dashboards and interactive data visualisations. This is especially important in situations where putting a real data-driven prototype in the hands of the end user allows for better refining of requirements before passing off to a web development team. This allows to speed up the delivery process and reducing the dependencies on other teams.
Code and solution to exercises available on github: https://github.com/amguedes/ShinySeminar
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
In this talk, I explain how to use CouchDB mobile to connect your iPhone or Android phone with a a remote ChouchDB to build a RunKeeper clone. The code for this talk is available at https://github.com/peterfriese/CouchTo5K
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences. For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely. This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
WildFly 8 application server
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
JavaCro 2014 Scala and Java EE 7 Development ExperiencesPeter Pilgrim
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences.
For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely.
This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
What SQL functionality was added in the past year or so. The presentation covers default expressions, functional key parts, lateral derived tables, CHECK constraints, JSON and spatial improvements. Also some other small SQL and other improvements.
Solutions for bi-directional Integration between Oracle RDMBS & Apache KafkaGuido Schmutz
A Kafka cluster stores streams of records (messages) in categories called topics. It is the architectural backbone for integrating streaming data with a Data Lake, Microservices and Stream Processing. Today’s enterprises have their core systems often implemented on top of relational databases, such as the Oracle RDBMS. Implementing a new solution supporting the digital strategy using Kafka and the ecosystem can not always be done completely separate from the traditional legacy solutions. Often streaming data has to be enriched with state data which is held in an RDBMS of a legacy application. It’s important to cache this data in the stream processing solution, so that It can be efficiently joined to the data stream. But how do we make sure that the cache is kept up-to-date, if the source data changes? We can either poll for changes from Kafka using Kafka Connect or let the RDBMS push the data changes to Kafka. But what about writing data back to the legacy application, i.e. an anomaly is detected inside the stream processing solution which should trigger an action inside the legacy application. Using Kafka Connect we can write to a database table or view, which could trigger the action. But this not always the best option. If you have an Oracle RDBMS, there are many other ways to integrate the database with Kafka, such as Advanced Queueing (message broker in the database), CDC through Golden Gate or Debezium, Oracle REST Database Service (ORDS) and more. In this session, we present various blueprints for integrating an Oracle RDBMS with Apache Kafka in both directions and discuss how these blueprints can be implemented using the products mentioned before.
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafk...confluent
A Kafka cluster stores streams of records (messages) in categories called topics. It is the architectural backbone for integrating streaming data with a Data Lake, Microservices and Stream Processing. Today's enterprises have their core systems often implemented on top of relational databases, such as the Oracle RDBMS. Implementing a new solution supporting the digital strategy using Kafka and the ecosystem can not always be done completely separate from the traditional legacy solutions. Often streaming data has to be enriched with state data which is held in an RDBMS of a legacy application. It's important to cache this data in the stream processing solution, so that It can be efficiently joined to the data stream. But how do we make sure that the cache is kept up-to-date, if the source data changes? We can either poll for changes from Kafka using Kafka Connect or let the RDBMS push the data changes to Kafka. But what about writing data back to the legacy application, i.e. an anomaly is detected inside the stream processing solution which should trigger an action inside the legacy application. Using Kafka Connect we can write to a database table or view, which could trigger the action. But this not always the best option. If you have an Oracle RDBMS, there are many other ways to integrate the database with Kafka, such as Advanced Queueing (message broker in the database), CDC through Golden Gate or Debezium, Oracle REST Database Service (ORDS) and more. In this session, we present various blueprints for integrating an Oracle RDBMS with Apache Kafka in both directions and discuss how these blueprints can be implemented using the products mentioned before.
Solutions for bi-directional integration between Oracle RDBMS & Apache KafkaGuido Schmutz
Apache Kafka is a popular distributed streaming data platform. A Kafka cluster stores streams of records (messages) in categories called topics. It is the architectural backbone for integrating streaming data with a Data Lake, Microservices and Stream Processing. Data sources flowing into Kafka are often native data streams such as social media streams, telemetry data, financial transactions and many others. But these data stream only contain part of the information. A lot of data necessary in stream processing is stored in traditional systems backed by relational databases. To implement new and modern, real-time solutions, an up-to-date view of that information is needed. So how do we make sure that information can flow between the RDBMS and Kafka, so that changes are available in Kafka as soon as possible in near-real-time? This session will present different approaches for integrating relational databases with Kafka, such as Kafka Connect, Oracle GoldenGate and bridging Kafka with Oracle Advanced Queuing (AQ).
Understand what NoSQL is and what it is not. Why would you want to use NoSQL within your project and which NoSQL database would you utilize. Explore the relationships between NoSQL and RDBMS. Understand how to select between an RDBMs (MySQL and PostgreSQL), Document Database(MongoDB), Key-Value Store, Graph Database, and Columnar databases or combinations of the above.
Similar to Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016 (20)
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.ioLuigi Dell'Aquila
In these slides I show how to create a simple application where all the components act in a reactive (push/asynchronous) way, including the database.
I'll show a preview of a new functionality that is being released in OrientDB: Live Query
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
2. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Luigi Dell’Aquila
Core Developer and Director of Consulting
OrientDB LTD
Twitter: @ldellaquila
http://www.orientdb.com
4. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Summary
•What is OrientDB
•OrientDB GeoSpatial API
•Importing Geo data (Java and/or Node.js)
•Querying Geo data (OrientDB Studio)
•Displaying Geo data (Angular2, Google Maps)
•Adding Relationships - graph data
•Graph + Spatial queries
5. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
What is OrientDB
•Multi-Model Database (Document, Graph and more)
•Tables Classes
•Extended SQL
•JOIN Physical Pointers
•Schema, No-Schema, Hybrid
•HTTP + Binary protocols
•Stand-alone or Embedded
•Distributed Multi-Master
•Apache 2 license
6. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Install
•http://www.orientdb.com/download/
•http://central.maven.org/maven2/com/
orientechnologies/orientdb-spatial/VERSION/
orientdb-spatial-VERSION-dist.jar
> cd orientdb-community/bin/
> ./server.sh
7. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
OrientDB GeoSpatial Classes
•OPoint
•OLine
•OPolygon
•OMultiPoint
•OMultiline
•OMultiPlygon
9. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
OrientDB GeoSpatial Functions
•ST_GeomFromText(text)
•ST_Equals(geom, geom)
•ST_Contains(geom, geom)
•ST_Disjoint(geom, geom)
•ST_Intersects(geom, geom)
•ST_Distance_Sphere(geom, geom)
•and more…
10. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Create the Schema
CREATE CLASS POI EXTENDS V
CREATE PROPERTY POI.location EMBEDDED OPoint
CREATE INDEX POI.location on POI(location) SPATIAL ENGINE LUCENE
CREATE CLASS Natural EXTENDS V
CREATE PROPERTY Natural.location EMBEDDED OPolygon
CREATE INDEX Natural.location on Natural(location) SPATIAL ENGINE LUCENE
CREATE CLASS Person EXTENDS V
CREATE PROPERTY Person.location EMBEDDED OPoint
CREATE CLASS FriendOf EXTENDS E
11. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Our Data Source (WKT)
WKT,osm_id,name,type
"POINT (14.4641804 50.0972109)",24569342,"Invalidovna, Metro B",station
"POINT (14.4739792 50.1036789)",24569358,"Palmovka, Metro B",station
"POINT (14.4921863 50.1062907)",24569412,"Českomoravská, Metro B",station
12. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Now let’s import data!
Let’s do it in Java
you can download some Geo files from
http://www.mapcruzin.com/free-italy-arcgis-maps-shapefiles.htm
and convert them to WKT using QGis (www.qgis.org)
13. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Maven Dependencies
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-graphdb</artifactId>
<version>2.2.13</version>
</dependency>
14. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Read from CSV
Reader reader = new FileReader("/path/to/poi_file.csv");
CSVParser parser = CSVFormat.DEFAULT.parse(reader);
Iterator<CSVRecord> iterator = parser.iterator();
iterator.next(); //discard the header
while(iterator.hasNext()){ //read each row
importRecord(iterator.next());
}
15. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
OrientDB connection
Reader reader = new FileReader("/path/to/poi_file.csv");
CSVParser parser = CSVFormat.DEFAULT.parse(reader);
Iterator<CSVRecord> iterator = parser.iterator();
iterator.next(); //discard the header
OrientGraph graph =
new OrientGraph("remote:localhost/testdb", "admin", "admin");
while(iterator.hasNext()){ //read each row
importRecord(iterator.next(), graph);
}
graph.shutdown();
16. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
importRecord()
void importRecord(CSVRecord record, OrientGraph graph) {
String wkt = record.get(0);
String name = record.get(2);
String type = record.get(3);
graph.command(new OCommandSQL(
"insert into Natural " +
"set name = ?, type = ?, " +
"location = ST_GeomFromText(?)"))
.execute(name, type, wkt);
}
19. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Clone the scaffolding
> git clone https://github.com/luigidellaquila/geospatial-demo
> cd geospatial-demo
> npm install
(it’s a clone of https://github.com/angular/quickstart)
> npm start
20. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Clone the scaffolding
> git clone https://github.com/luigidellaquila/geospatial-demo
> cd geospatial-demo
> npm install
(it’s a clone of https://github.com/angular/quickstart)
> npm start
> cd <orientdb-home>/www
> ln -s <quickstart-path>
> tsc -w
21. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
We need Google Maps
<script src=“https://maps.googleapis.com/maps/api/js?key=API_KEY"
async defer></script>
22. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Let’s display a map (app.html)
<div class=“container">
<div class="row">
<div class="col-md-12" id="map" style=“height:600px"></div>
</div>
</div>
23. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Draw the map
drawMap(){
var controller = this;
let mapProp = {
center: new google.maps.LatLng(40.399640, -3.8375544),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
controller.map = new google.maps.Map(document.getElementById("map"), mapProp);
controller.map.addListener("click", function(point: any){
controller.zone.run(()=> {
controller.lat = point.latLng.lat();
controller.lon = point.latLng.lng();
});
});
}
24. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Create a Person
createPerson(): void{
var location = {
// the location object
}
var queryString = ””; // OrientDB statement
this.orient.command(
queryString,
(result) => { /* Success callback */ },
(error) => { /* Error callback */ }
);
}
25. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Create a Person
createPerson(): void{
var location = {
"@class": "OPoint",
coordinates: [this.lon, this.lat]
}
var queryString = ””; // OrientDB statement
this.orient.command(
queryString,
(result) => { /* Success callback */ },
(error) => { /* Error callback */ }
);}
26. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Create a Person
createPerson(): void{
var location = {
"@class": "OPoint",
coordinates: [this.lon, this.lat]
}
var queryString = `insert into Person
set name = '${this.personName}',
location = ${JSON.stringify(location)}`;
this.orient.command(
queryString,
(result) => { /* Success callback */ },
(error) => { /* Error callback */ }
);
}
27. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Create a Person
createPerson(): void{
var location = {
"@class": "OPoint",
coordinates: [this.lon, this.lat]
}
var queryString = `insert into Person
set name = '${this.personName}',
location = ${JSON.stringify(location)}`;
this.orient.command(
queryString,
(res) => {
let body = res.json();
let person = body.result[0];
this.addPersonToMap(person)
},
(e) => { console.log(e) });
}
28. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Add Person Vertex to Orient via REST API
command(statement: string, success: (data: any) => void, error: (err: any) => void): void{
var url = this.url + "sql/-/-1"
var headers = new Headers();
headers.append("Authorization", "Basic " + btoa(this.username+":"+this.password));
this.http.post( // HTTP POST
url, // the URL
JSON.stringify({
"command": statement // the SQL command
}),
{headers: headers} // the authentication data
).toPromise()
.then(success)
.catch(error);
}
29. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Add Person to the Map
addPersonToMap(personData:any){
let location = personData.location;
let coordinates = location.coordinates;
let controller = this;
let marker = new google.maps.Marker({
position: {lat:coordinates[1], lng:coordinates[0]},
map: this.map,
title: personData.name,
rid: personData["@rid"]
});
google.maps.event.addListener(marker, 'click', function() {
controller.onMarkerClick(marker);
});
}
30. Luigi Dell’Aquila @ldellaquila Milan - Nov 25-26 2016
Add an edge between people
(FriendOf)
createEdge(from:any, to:any): void{
this.orient.command(
`create edge FriendOf from ${from.rid} to ${to.rid}`,
(x)=>{console.log(x)},
(x)=>{console.log(x)}
)
this.addEdgeBetweenMarkersToMap(from, to);
}