OData metadata and URIs - odata

First off, I'll say that this is no where near my field of expertise. I am pulling this data into an Excel Power Query from a public OData feed, below is the metadata url:
https://safetydata.fra.dot.gov/MasterWebService/PublicApi/frads/v1/odata/gcis/$metadata
When I request a dataset, it returns a "Crossing" with each of those Properties defined in that metadata above (can't post a link to a dataset since it requires a token), but below is essentially what's returned.
<ArrayOfCrossing>
<Crossing>
<Property></Property>
</Crossing>
</ArrayOfCrossing>
Where I am lost, is how I drill down into that metadata and return the metadata about each property. For instance, the property 'CntyCD' (County) returns a code that refers to a County. Instead of the code, I want the County name.
What I have tried:
Reviewing OData 2, 3, and 4 URI references
Spent hours reviewing different sites, reading and trying all sorts of different URI combinations
There's not much documentation on the API website other than forming basic queries.
If anyone could take a look at this metadata url and help me understand the "shape" of the metadata or point me to any resources I would be extremely grateful.

For anyone finding this later, the answer is you cannot derive any additional metadata from this. You have to build your own lookup tables from various sources on their website.
My source to this solution is the folks who administer the data source (Federal Railroad Administration) who pointed me to this URL: https://safetydata.fra.dot.gov/OfficeofSafety/publicsite/DownloadCrossingInventoryData.aspx
The above url contains various lookup tables in CSV format under the heading “Reference Data and Documents”, as well as a pdf explaining the coding for each field. From what I can see, most of the fields have their values listed in one or more of those downloadable files.
Not the solution I was hoping for, but it works. I was hoping to get the values from a query and not by maintaining my own table data, which will need to be updated as they make any changes to their lookups.

OData is great, $metadata is a rich descriptive language that allows the API developers to express the structural bounds of the schema. A well defined service $metadata you should be able to describe most valid input and output expessions. The metadata for the property in question is this:
<Property Name="CntyCD" Type="Edm.String" frads:DisplayName="County"/>
Unfortunately, as this property is described as a String with no validation or other constraints, and there are no further annotations regarding this property in the $metadata, then there is no further information that can be found using the standards simply because their schema is not well designed to allow you to obtain any further information.
So this isn't a deficiency in the OData Protocol itself, just a deficiency in the specific API that you are querying.
A common way to specify that one property is dependant on a specific list of values is to include a navigation property, or at least to specify that a property returns a collection or instance of a complex type. if we look at the TripPinService you can see this type of information:
<EntityType Name="Person">
<Key>
<PropertyRef Name="UserName"/>
</Key>
<Property Name="UserName" Type="Edm.String" Nullable="false"/>
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" MaxLength="26"/>
<Property Name="MiddleName" Type="Edm.String"/>
<Property Name="Gender" Type="Trippin.PersonGender" Nullable="false"/>
<Property Name="Age" Type="Edm.Int64"/>
<Property Name="Emails" Type="Collection(Edm.String)"/>
<Property Name="AddressInfo" Type="Collection(Trippin.Location)"/>
<Property Name="HomeAddress" Type="Trippin.Location"/>
<Property Name="FavoriteFeature" Type="Trippin.Feature" Nullable="false"/>
<Property Name="Features" Type="Collection(Trippin.Feature)" Nullable="false"/>
<NavigationProperty Name="Friends" Type="Collection(Trippin.Person)"/>
<NavigationProperty Name="BestFriend" Type="Trippin.Person"/>
<NavigationProperty Name="Trips" Type="Collection(Trippin.Trip)"/>
</EntityType>
However even then, the specific validation rules become more data related, even if the structure is correct. We can only inspect data values by querying them from somewhere. In the case of TripPin, it does provide endpoints to lookup the necessary information.
If there was a finite list of possible static values, then this should be defined in the $metadata as an Enum, an example again from TripTip where there is a PersonGender enum defined:
<EnumType Name="PersonGender">
<Member Name="Male" Value="0"/>
<Member Name="Female" Value="1"/>
<Member Name="Unknown" Value="2"/>
</EnumType>
As this is a question about data and not the schema. And this API does not provide an endpoint to return the possible CntyCD values then one option is to query the unique values for CntyCD from this table:
https://safetydata.fra.dot.gov/MasterWebService/PublicApi/frads/v1/odata/gcis/Crossings?$apply=groupby((CntyCD))
NOTE: This resultset can not be guaranteed to be a finite list of ALL possible values, but it might be adequate for your needs.
When dealing with public or government APIs, when the data structure assumes that you must already know about some aspects of the data, then they are likely to have published that list of data in a separate location.
A good place to start is to goto the host or root of the API's URL to see if there is any documentation served as html or some other browsable form. In this case https://safetydata.fra.dot.gov does provide a listing and in the menu you can see they have Downloads and in that list is FRA Auxiliary Tables
If that information was not available, then the local postal service for any region is usually a great place to start looking for location demographic information.

Related

Retrieving Full sized images stored in a Image type column in a dataverse table through Azure API Management

We are storing images in a dataverse table under the Image type column When trying to retrieve it using an OData call through API management it only returns the image at icon size(144x144).
I have tried to use [Organization URI]/api/data/v9.1/accounts(C0864F1C-0B71-E911-8196-000D3A6D09B3)/myentityimage/$value?size=full but the clients are not authenticated to the backend so while it works in testing it wont work in a production environment.
We build up our OData query using FetchXML. It gives us the option to select the image which returns it in BASE64 but only as a icon(144x144).
Is there any way using this method to return the full image. I cannot find how to append the Size=Full
FetchXML we are using.
<fetch>
<entity name="[Entity Name]">
<attribute name="bt_attachment" />
</entity>
</fetch>
OData query that it generates.
https://[Organization URI].crm4.dynamics.com/api/data/v9.2/[Table Name]?$select=bt_attachment
The image column is the only one return.

In a <meta>, what is the correct Dublin Core property name to express distinctly spatial and temporal coverage?

I have an application where some <meta> must be included to the pages for RDFa.
I had to merely report the properties stated by my client in its requirement document.
All was fine for many properties like dc:title, dc:subject, etc.
But two requirements appeared more complicated for me. They were precisely expressed like this:
dc:coverage (spatial)
dc:coverage (temporal)
Being not a guru about RDFa, I looked for more information and found that in the real HTML <meta>it could be expressed like this:
dc:coverage.spatial
dc:coverage.temporal
But now a third party representing the crawler that will use my page says me that those properties don't exist!
So I can't figure out what I should actually write in place.
Dublin Core defined two sub-properties for the coverage property: spatial and temporal. This parent-child relationship is specified in the RDF definition; there is no need to refer to the super-property when using its sub-property.
If it’s a spatial value:
<meta property="dc:spatial" content="" />
If it’s a temporal value:
<meta property="dc:temporal" content="" />
If it’s unknown whether it’s a spatial or temporal value:
<meta property="dc:coverage" content="" />

Query TFS based on value change of a field

There is any possibility in TFS UI to query based value changed of a field?
E.g.
Query all work items which have changed Automation status field to "Automated" in the past 2 days.
If the Automation status field reference the System.State (reference name), then you can try below query:
If the filed doesn't reference System.State, then we cannot achieve the requirement.
However you can custom a field and apply rules for the field to copy the value of State Change Date, something like this :
<FieldDefinition name="test" refname="test.date" type="DateTime">
<WHEN field="Automationstatus.xxx" value="Automated">
<COPY from="field" field="Microsoft.VSTS.Common.StateChangeDate" />
</WHEN>
<HELPTEXT>test</HELPTEXT>
</FieldDefinition>
Thus when you change Automation status to "Automated" for a work item, the changed date will be copied to the test filed. Then you can use the test field to filter the work items in future... but it's not available for current work items.
No there is no easy way to query on the change times of specific fields in the UI from the work item queries.
If your company has the Analytics Services turned on and available to users, then you could use Excel's Power Pivot tools to query the cube directly.
NOTE: The TFS Warehouse and Analytics Cube haven't seen major updates since their introduction in 2010 and are being replaced by the new OData based Analytics Service in Azure Devops.
I doubt there's a query parameter to satisfy your criteria entirely, but the closest I can come up with is this:

Setting up Umbraco Indexes

I've created a site using Umbraco 6.02, and I'm going over all the final configuration of the site now, and I've come to indexes. I've done some research, but I just cant find in simple terms what I need to include in each section and why.
Which fields I should include in the <IndexUserFields> section of the index? Is it just the fields I'll be using to search with, for example:currentNode.Children(x => x.bodyText.Contains("*"))? Or fields that I'll be using to sort nodes such as a date field for news articles? Or is there more to it than that?
Which document types do I need to put in the <IncludeNodeTypes> section and the <ExcludeNodeTypes> section and why?
And do I add my fields to one of the already created indexes, or do I create my own?
Old post but may help someone along the way.
http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx
You can create custom indexes (if you desire) to lock down what types of searching you're doing. Many times you have a search box somewhere on your page and you only want to search certain doc types and their related content.
Keep in mind that you can create NEW index sets, but remember that you'll need to register them in the Config/ExamineSettings.config file as well as the Config/ExamineIndex.config file.
The link above is how I got mine to work correctly for just searching (2) different doc types (which Examine uses as NodeTypes) in the config.
The settings below were created using the already default ExternalIndexer, not a newly created custom one.
The file that you want to edit is in Config/ExamineIndex.config. The set that you want to edit is the ExternalIndexSet (by default). The path will point to the external temp folder
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/">
For fields, that goes in the IndexUserFields section, which are custom properties that you have defined on your doc types
<IndexUserFields>
<add Name="itemNumber" /> <-- custom property
<add Name="productName" /> <-- custom property
</IndexUserFields>
The doc types (NodeTypes) that you want are whatever you named your document types. Remember that these are the alias, not the name
<IncludeNodeTypes>
<add Name="Product" /> <-- document type
<add Name="Variant" /> <-- document type
</IncludeNodeTypes>
Remember after setting this up you want to re-index your Examine. You can get to this by logging into the backend of Umbraco and going to Developer, then clicking on the tab that says Examine Management.
Please note that the interface is Umbraco 7 but the config file will still be applicable for v6.

SharePoint list updated column names not showing up through web services

I am using the GetListItems() method in Lists.asmx on a SharePoint 2007 server. I have noticed that when a column's name is changed in SharePoint, the web service continues to send back the column's original name instead of the new name.
I understand this is generally a good thing, but what can I do to get the service to send me the updated column name when that's what I want? Other than creating a new column, copying data, and deleting the original column?
Thanks.
Because GetListItems() uses internal names that do not change once the column is created. Check the SharePoint Internal name, Static name, Display name article for more details.
Use the Lists.GetList method to retrieve list schema - it contains both Name and DisplayName:
<Fields>
<Field ColName="tp_ID" ReadOnly="TRUE" Type="Counter" Name="ID" PrimaryKey="TRUE" DisplayName="ID" FromBaseType="TRUE" />
<Fields>

Resources