Get all Schema.org schemas under a specific category (Place, LocalBusiness) - export

I'm wondering if there is a website or a way to get the list of all the Schema.org schemas under a specific category (ex: Place).
I found the complete list on Schema.org - they also provide a JSON-LD file - but there's no way to filter/order this easily.
My goal is to get the list of all the places in a nice array (PHP, JSON, whatever).

Most vocabularies/ontologies are defined using RDF.
The vocabulary Schema.org is no exception. The canonical/machine-readable representation of Schema.org is provided in HTML+RDFa:
http://schema.org/docs/schema_org_rdfa.html
This file always contains the current release. If you are interested in specific versions of Schema.org, snapshots are available.
As a quick overview:
Each Schema.org type is of type rdfs:Class.
Sub-types are specified with the rdfs:subClassOf property.
Each Schema.org property is of type rdf:Property.
Sub-properties are specified with the rdfs:subPropertyOf property.
The domains of a property (i.e., on which types this property is expected) are specified with the schema:domainIncludes property.
The ranges of a property (i.e., which values are expected) are specified with the schema:rangeIncludes property.
RDFa is a RDF serialization which many RDF parsers support (if not, it’s simple to automatically convert it into other RDF serializations, like Turtle, RDF/XML, or JSON-LD). There are many different tools and libraries available for this purpose. (You should use an RDF-aware tool instead of trying to parse the file as HTML.)

Related

Why is it `text/html` but `application/json` in media types?

What's the difference between application and text in media types and when do they use what?
For example there is text/html but on the other hand it's application/json.
Is this a historical thing?
This is described on the MIME types page of the mozilla documentation.
application refers to any kind of binary data while text is theoretically human readable.
type/subtype
The structure of a MIME type is very simple; it consists of a type and
a subtype, two strings, separated by a '/'. No space is allowed. The
type represents the category and can be a discrete or a multipart
type. The subtype is specific to each type.
A MIME type is case-insensitive but traditionally is written all in lower case.
Further down the page you can find a table containing the discrete types:
Type Description
text Represents any document that contains text and is theoretically human readable
image Represents any kind of images. Videos are not included, though animated images (like animated gif) are described with an image type.
audio Represents any kind of audio files
video Represents any kind of video files
application Represents any kind of binary data.
To answer your question about JSON, while you'll frequently come across JSON that is human readable it's primarily used for containing data and isn't necessarily intended to simply be read. Meanwhile a machine can always easily convert the data from JSON into an object (assuming the JSON is correctly formatted).

Grails 3 "show" view with Fields plugin 2.1.0-SNAPSHOT

Stuck at a trivial problem in Grails 3.1.5: Show the fields of a domain object, excluding one of them, including a transient property. Yes, this is my first Grails 3 project after many years with previous versions.
The generated show.gsp contains
<f:display bean="rfaPdffile"/>
This will include a field that may contain megabytes of XML. It should never be shown interactively. The display: false constraint is no longer in the docs, and seems to be silenty ignored.
Next I tried explicitly naming the fields:
<f:with bean="rfaPdffile">
<f:display property='fileName'/>
<f:display property='pageCount'/>
...
</f:with>
This version suprisingly displays the values without any markup whatsoever. Changing display to field,
<f:with bean="rfaPdffile">
<f:field property='fileName'/>
<f:field property='pageCount'/>
...
</f:with>
sort of works, but shows editable values. So does f:all.
In addition I tried adding other attributes to f:display: properties (like in f:table), except (like in f:all). I note in passing that those two attributes have different syntax for similar purposes.
In the Field plugin docs my use case is explicitly mentioned as a design goal. I must have missed something obvious.
My aim is to quickly throw together a prototype gui, postponing the details until later. Clues are greatly appreciated
If I understood you correctly, you want to have all bean properties included in the gsp but the one with the "megabytes of XML" should not be displayed to the user?
If that is the case you can do:
f:with bean="beanName"
f:field property="firstPropertyName"
f:field property="secondPropertyName"
And the one you don't wish to display:
g:hiddenField name="propertyName" value="${beanName.propertyName?}"
f:with
So list all the properties as f:field or f:display and put the one you don't wish to display in a g:hiddenField Grails tag
You can also try:
f:field property="propertyName"
widget-hidden="true"
but the Label is not hidden in this case.
Hope it helps
My own answer: "use the force, read the source". The f:display tag has two rather obvious bugs. I will submit a pull request as soon as I can.
Bugs aside, the documentation does not mention that the plugin may pick up the "scaffold" static property from the domain, if it has one. Its value should be a map. Its "exclude" key may define a list of property names (List of String) to be excluded. This probably works already for the "f:all" tag; bug correction is needed for the "f:display" tag.
My subjective impression is that the fields plugin is in a tight spot. It is intertwined with the Grails architecture, making it sensitive to changes in Grails internals. It is also required by the standard scaffolding plugin, making it very visible. Thus it needs constant attention from maintainers, a position not to be envied. Even now conventions for default constraints seem to have changed somewhere between Grails 3.0.9 and 3.1.7.
Performance of the fields plugin is sensitive to the total number of plugins in the app where it is used. It searches all plugins dynamically for templates.
For the wish list I would prefer stricter tag naming. The main tags should be verbs. There are two main actions, show and edit. For each action there are two main variants, single bean or multiple beans.
My answer is that at present (2 March 2017) there is no answer. I have searched the Net high and low. For the index (list) and create and edit views, the fields plugin works well enough. A certain field can be easily excluded from the create and edit views, relatively easily from the list view (by listing those that should show), and in no way I could find from the show view. This is such a common need that one would suspect it will be addressed soon. Also, easily showing derived values in the show view, like 'total' for an invoice. One can do that by adding an ordered list with a list item showing the value below the generated ordered list of values, but that is kind of a hack.
In some ways, the old way was easier. Yes, it generated long views, but they were generated and didn't have to be done by the programmer - just custom touches here and there.

Loading different files using OWL API

I am using OWL API to load different files and merge into one for reasoning. I have one file describing the ontology and several files with individuals. Every individual has foaf properties, e.g., foaf:title, when I print the axioms it shows
'AnnotationAssertion(http://xmlns.com/foaf/0.1/title...'
and reasoning does not work. If I add
<'owl:DatatypeProperty rdf:about="http://xmlns.com/foaf/0.1/title'/>
into the individual file than title loads as
'DataPropertyAssertion(http://xmlns.com/foaf/0.1/title...' and reasoning works.
In the FOAF ontology is says that it is a data property, but loading it did not work either. I am using OWLOntologyMerger to merge the ontologies.
And I cannot add that into every file. Is there a way to do it programmatically or any way?
Thanks.
Use owl:imports from each file to import the base ontology, or foaf.
The problem here is that the owl api needs the declaration to be available either in the file or in the imported ontologies. It is not possible to parse rdf/XML unambiguously otherwise.

Dynamic locale name in multi-language site

I am developing an application in cakephp 2.3.4, Which is multi-language.
Admin can add any number of new languages.
My question is, When admin decides to add a new language, how resulting locale name should be defined.
Can a locale name be any arbitrary name, given by admin or it should be a dropdown containg all languages code according to language.
Unfortunately, your question is a bit 'vague', i.e., will administrators be able to add GNU-locale files (*.po), or are you talking about adding translations inside the database.
In any case, CakePHP uses locales according to the ISO 639-3 standard see here and here for more information. A complete list of those locales can be found inside the I10n class.
Since you probably also want to switch the locale of PHP itself when switching locales, so that, for example, date, money and time-formats will follow the right format for the locale, it's best to stick with those locales and not 'invent' your own locales.
See setlocale(). Be aware though, that PHP may use slightly different locale-codes than CakePHP uses. And it will depend on what locales are installed on your server.
To get a list of locales installed on your server, use locale -a on the command line. See this page for more information: https://wiki.archlinux.org/index.php/Locale
Which techniques to use for localization
A quick summary of techniques to use;
Short messages (interface/UI)
In general, locale files are used for short pieces of text. Locale-files are therefore mostly used for fixed strings,
for example, strings that are used in the interface (like 'are you sure you want to delete this file?' => 'weet u zeker dat u dit bestand wilt verwijderen?).
Longer (fixed) text
For longer pieces of text in your application, that are not part of the 'content' (not the blog-post, but for example a fixed page with a disclaimer),
it's best to use separate views for translated content, for example;
app/Views/MyController/disclaimer_eng.ctp
app/Views/MyController/disclaimer_deu.ctp
app/Views/MyController/disclaimer_fre.ctp
Content
For the content of your website (the part of your website that is managed by the 'user' of the website),
put translations inside the database. This data may be updated frequently and all translations should be updated as well.
How to implement this, is really up to you and depends on your situation. CakePHP offers a Translate behavior that you can use (http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html), but in most of my situations that behavior didn't really fit our needs (IMO it is not very efficient, because it stores translations per-field, per-model).

App Engine - why are there PhoneNumber, Link, Rating etc classes?

I haven't found any reason for the existence of a few of the App Engine classes. There's a PhoneNumber, a Link, a PostalAddress, a GeoPt, a Rating, etc. Why are these given special treatment? They don't seem to have any smarts - e.g. geo searching. I know Link has more space than a String property, but the rest?
See:
http://code.google.com/appengine/docs/java/datastore/dataclasses.html
Those types are 'semantic' types. They're present in the Java API for parity with the Python API. In the Python API, they define special behaviour with regards to the .to_xml() method - for example, a PhoneNumberProperty serializes like this:
<property name="foo" type="gd:phonenumber"><gd:phoneNumber>12345-678</gd:phoneNumber></property>
I think they're mostly just there to cover common cases and save developers time. If a lot of apps use a phone number field, why require each developer to have to write them? A developer can still write their own if they need/want to.
Not sure about java, but in python the following model/code (tested on dev server) will throw BadValueError, with the message "Invalid URL: stackoverflow.com"
class foo(db.model):
link = db.LinkProperty()
bar = foo()
bar.link = 'stackoverflow.com'
While:
bar.link = 'http://stackoverflow.com'
Works fine.
I haven't tested, but the other properties may or may not also do validation.
Basically using this types in your models allows to add indirect meta data to your code. This may be useful if you are working with any kind of universal renderer for your model classes or if you are performing validation of user input on your models.
For example if you are using PhoneNumber type for a field named userNumber you reflection based renderer may understand that it should automatically assign corresponding validator to text field which will represent it.
Regards,
Pavel.

Resources