how it works
Create a dGraph
After you login to the site, go to your list of dGraphs. You can find this in
your user toolbox under "dgraph list". Create a dGraph and by clicking the "Add
New dGraph" link at the bottom of the page.
Now create a dGraph by filling out the required fields. To define the Auto
dGraph used as the example thoughout this site use the name "Auto" for object
anme. Press the "Save and Setup" button to create the dGraph and begin defining
fields. You can specify individual fields or use an upload file. Save the
following text to a file and upload it as your field definition file.
*ListingId,int,,field
State,string,50,dimension,normal
Location,geocode,,field
Make,string,50,dimension,normal
Model,string,50,dimension,normal,make
Price,int,,dimension,range,,10000
Mileage,int,,dimension,range,,10000
City,string,50,dimension,normal,state
Zip,int,10,field
Description,string,2000,field
Title,string,200,field
PostDate,date,,field
Year,int,,dimension,normal
Engine,string,,field
ExteriorColor,string,,dimension,normal
InteriorColor,string,,dimension,normal
Condition,string,,dimension,normal
Transmission,string,,field
Vin,string,,field
FuelType,string,,dimension,normal
Cylinders,int,,field
Invoice,int,,field
BodyType,string,,dimension,normal
BulletPoints,list,,field
FeatureList,list,,dimension,list
Metro,string,,dimension,normal
MpgCity,int,,field
MpgHighway,int,,field
Implement Repository
After you have saved your new graph, go back to the dGraph Maintenance screen
and click the "Implement" link. This will bring you to a page to confirm that
you wish to actually create the graph in production. Simply click the
"Implement" on this page to create the a working repository. In your web.config
file or app.config file you will need to add this secion to the servicemodel
section.
Add Data
Now that you have a working repository you can add data to it. This is done
programatically by connecting to your custom web service and uploading data.
Open a VS.NET project and add a service reference. Use the Access URL for the
repository. This can be found on the dGraph list screen. The URL will look
something like this
"http://www.celeriq.com/services/X415239ebe7e44f9dbc6e56dc855c81b2.svc". Choose
a name for the service. I have choosen "RepositoryService" for this example.
<bindings>
<basicHttpBinding>
<binding name="LargeBuffer" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
<binding name="BasicHttpBinding_IDataService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None"> <transport clientCredentialType="None"
proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
&<behaviors>
<endpointBehaviors>
<behavior name="CeleriQDataServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>
Simple declare the service and declare the custom object.
In this example, we named our object "Auto" so we have a strongly-typed object called "AutoItem".
Decalre an object of this type, set its properties and save it.
That is all that needs to be done.
The data is in the repository now.
You can also add an array of these object by calling the "AddDataList" method instead of the "AddData" method.
When you are done adding data, call the "Summarize" method to signal that you have completed the import operation.
RepositoryService.DataServiceClient service = new RepositoryService.DataServiceClient();
RepositoryService.AutoItem newItem = new RepositoryService.AutoItem();
newItem.ListingID = 1;
...
service.AddData(newItem);
service.Summarize();
Query Data
Now you can query the data using the web service.