Return-Path: X-Original-To: apmail-atlas-dev-archive@minotaur.apache.org Delivered-To: apmail-atlas-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C25D518776 for ; Thu, 1 Oct 2015 20:31:00 +0000 (UTC) Received: (qmail 96705 invoked by uid 500); 1 Oct 2015 20:30:38 -0000 Delivered-To: apmail-atlas-dev-archive@atlas.apache.org Received: (qmail 96667 invoked by uid 500); 1 Oct 2015 20:30:38 -0000 Mailing-List: contact dev-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list dev@atlas.incubator.apache.org Received: (qmail 96654 invoked by uid 99); 1 Oct 2015 20:30:38 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2015 20:30:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 08B6DC00B1 for ; Thu, 1 Oct 2015 20:30:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3 X-Spam-Level: *** X-Spam-Status: No, score=3 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 9ZHR1zONcBi2 for ; Thu, 1 Oct 2015 20:30:29 +0000 (UTC) Received: from imap10-4.ox.privateemail.com (imap10-4.ox.privateemail.com [198.187.29.252]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id D4E7B203BA for ; Thu, 1 Oct 2015 20:30:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id EB6762400E4 for ; Thu, 1 Oct 2015 16:30:20 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UoJyIZdH497b for ; Thu, 1 Oct 2015 16:30:20 -0400 (EDT) Received: from [192.168.0.8] (CPE08626696eac8-CM788df7fd6770.cpe.net.cable.rogers.com [99.238.53.220]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 90E432400DA for ; Thu, 1 Oct 2015 16:30:20 -0400 (EDT) From: Herman Yu Content-Type: multipart/alternative; boundary="Apple-Mail=_085D158B-08C6-4EB9-9636-793AAE6B5397" Message-Id: <5CE9397D-5DED-40EC-85DC-5D51FCF1CCD0@teeupdata.com> Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: creating a new entity/associating an entity to another one Date: Thu, 1 Oct 2015 16:30:08 -0400 References: <3D8A5073-C50A-4B58-9386-745770DE7D11@teeupdata.com> To: dev@atlas.incubator.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1878.6) --Apple-Mail=_085D158B-08C6-4EB9-9636-793AAE6B5397 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Thanks Seetharam, see my comments below. On Oct 1, 2015, at 4:22 PM, Seetharam Venkatesh = wrote: > The easiest way to do this is to use the type system API. Please look = at > the examples in QuickStart.java or any integration test under webapp = module. >=20 [HY] I am doing some POC work, and would like to use REST API for quick = test. Is it possible? > If you plan to associate 2 entities, say A and B together, then A = needs to > compose B. However, you want to associate traits (tags), then you can > associate any arbitrary Trait to any entity. There are APIs for both. [HY] I can associated Traits to any entity. To associate two Entities. = Would you please elaborate "A has to compose B=94. the relationship in = my test is quite similar to the hive model, many "hive_table=94 are = associated a =93hive_db=94, in my test, many =93Asset=94 are associated = to =93BusinessMetaData=94. what is the best way for me got get the details json definition so to = use REST API through command line, or I have to go with type system API = using Java? Thanks Herman. >=20 > On Thu, Oct 1, 2015 at 1:18 PM Herman Yu = wrote: >=20 >> Hi Everyone, >>=20 >> I am implementing a model in v0.5, and I would like to know the = correct >> syntax of creating a new entity, and associating an entity to another = one. >>=20 >> I have two objects/classTypes defined as: >>=20 >>=20 >> { >> "typeName=94:=94BusinessMetadata", >> "attributeDefinitions":[ >> { >> "name=94:=94Category", >> "dataTypeName=94:=94string", >> =85 >> }, >> ... >> ] >> } >> =85 >>=20 >> { >> "typeName=94:"Asset", >> "attributeDefinitions":[ >> { >> "name=94:"busMeta", >> "dataTypeName=94:"BusinessMetadata", >> =85 >> }, >> ... >> ] >> }, >>=20 >> and i would like to create an entity of =93BusinessMetaData=94 and = then >> associate it with an existing entity of Asset, what is the correct >> syntax/json definition using REST API http:// =85api/atlas/entities = -x PUT >> . Or is there a documentation which can help? >>=20 >> I tried to create the entity of =93BusinessMetaData=94 through REST = API using >> an entity definition of : >> { >> "typeName":"BusinessMetaData", >> "values":{ >> "category":"MiddleOffice", >> =85.. >> } >> } >>=20 >> but got the following error: >>=20 >> 2015-10-01 16:13:02,228 ERROR - [177746769@qtp-159259014-74 - >> 82c2ab59-556a-4e62-979c-ef7711059fdb:] ~ Unable to deserialize json=3D{= >> "typeName":"BusinessMetaData", "values":{ >> "category":"MiddleOffice", "term":"FX Trade", = "description":"FX >> Trades of Middle Office" }} (DefaultMetadataService:244) >> org.json4s.ParserUtil$ParseException: unknown token >> Near: { >> at = org.json4s.native.JsonParser$Parser.fail(JsonParser.scala:207) >> at >> org.json4s.native.JsonParser$Parser.nextToken(JsonParser.scala:294) >> at >> org.json4s.native.JsonParser$$anonfun$1.apply(JsonParser.scala:159) >> at >> org.json4s.native.JsonParser$$anonfun$1.apply(JsonParser.scala:117) >> at org.json4s.native.JsonParser$.parse(JsonParser.scala:105) >> at org.json4s.native.JsonParser$.parse(JsonParser.scala:53) >> at = org.json4s.native.Serialization$.read(Serialization.scala:71) >> =85=85 >> 2015-10-01 16:13:02,228 ERROR - [177746769@qtp-159259014-74 - >> 82c2ab59-556a-4e62-979c-ef7711059fdb:] ~ Unable to persist entity = instance >> (EntityResource:112) >> java.lang.IllegalArgumentException: Unable to deserialize json >> at >> = org.apache.atlas.services.DefaultMetadataService.deserializeClassInstance(= DefaultMetadataService.java:245) >> at >> = org.apache.atlas.services.DefaultMetadataService.createEntity(DefaultMetad= ataService.java:229) >> at >> = org.apache.atlas.web.resources.EntityResource.submit(EntityResource.java:9= 6) >> at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown = Source) >> at >> = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm= pl.java:43) >>=20 >>=20 >> Thanks >> Herman >>=20 >>=20 --Apple-Mail=_085D158B-08C6-4EB9-9636-793AAE6B5397--