Super lightweight classes for developing cool RESTful APIs. Based on Respect/Rest package.
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src
tests
.gitignore
.project
.scrutinizer.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
Vagrantfile
composer.json
composer.lock
phpunit.xml.dist

README.md

BOTK\Core

Build Status Code Coverage Latest Version Total Downloads License

Super lightweight classes for developing smart gateways to populate a business knowlege base compliant with KEES model.

quickstart

The package is available on Packagist. You can install it using Composer.

composer require botk/core

Installation

This package require composer.

Add following dependance to composer.json file in your project root:

    {
        "require": {
            "botk/core": "~6.0",
        }
    }

Usage

See examples directory.

BOTK Language profile

The BOTK language profile it is a Semantic Web application profile that extends schema.org with some business related stuff. BOTK is compatible with KEES (Knowledge Exchange Engine Schema) applications.

Following vocabularies are partially supported:

Vocabulary Prefix Namespace
xml schema xsd: http://www.w3.org/2001/XMLSchema#
rdf rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs rdfs: http://www.w3.org/2000/01/rdf-schema#
owl owl: http://www.w3.org/2002/07/owl#
Dublin Core dct: http://purl.org/dc/terms/
VoiD void: http://rdfs.org/ns/void#
PROV prov: < http://www.w3.org/ns/prov#>
schema.org schema: http://schema.org/
WGS 84 wgs: http://www.w3.org/2003/01/geo/wgs84_pos#
FOAF foaf: http://xmlns.com/foaf/0.1/
Data Cube qb: http://purl.org/linked-data/cube#
DaQ framework daq: http://purl.org/eis/vocab/daq#
SPARQL service sd: http://www.w3.org/ns/sparql-service-description#
KEES kees: http://linkeddata.center/kees/v1#
BOTK botk: http://botk.linkeddata.center/#

The primary focus o BOTK are Local Business, defined as a legal organization Business with at least a physical point of sell. BOTK vocabulary extends schema.org with some custom resource related to businesses:

String context

No string context should be used to qualify strings.

BOTK annotations

botk:[near]

States that the annotated subject is near (from a geographic point of view) to a another object.

botk:[similarStreet]

This functiona property States that the annotated LocalBusiness has an address translitteration (i.e. the string representation of a postal address from a lexical point of view) similar to the the one of another local business (e.g "Via Leonardo Da Vinci,1 - NAPOLI" is similar to "Viale L.Davinci,1 - MILANO").

botk:[similarName]

States that the annotated subject has a schema:alternateName that is to the the one of another object (e.g "BAR Roma" is similar to "Caffè di Roma").

Restrictiosn

schema:LocalBusiness

Captures the concept about a public legal registered business organization with a contactable geographic selling point .
This class can be specialized to state the reason of the business interest (e.g. see schema:LocalBusiness classifications).

Following properties/annotations supported:

  • rdf:type with cardinality >= 1 , type in the form of prefix:classname at least schema:LocalBusiness must be present
  • schema:vatID with cardinality <= 1, as Inverse Functional Property in country context ??
  • schema:taxID with cardinality <= 1,
  • schema:legalName with cardinality <= 1, as the legal name of the location
  • schema:alternateName with cardinality >= 0, contains the insignia of the shop as normalized text
  • schema:address with cardinality <=1 , contact info for this local business as a schema:PostalAddress individual
  • schema:geo with cardinality <= 1 pointer a schema:GeoCoordinates
  • schema:telephone with cardinality >= 0, formatted as string with no space, can start with '+', if 00 is present at the beginning,it is substituted with +, as primary telephone contact point for this location
  • schema:faxNumber with cardinality >= 0, same formatting of telephone, as primary fax contact point for this organization
  • schema:email with cardinality >= 0, as email for a contact point for this organization

Example (in rdf turtle):

ex:org1 a schema:LocalBusiness, schema:HealthAndBeautyBusiness ;
    schema:vatID "01209991007" ;
    schema:legalName "ERBORISTERIA \"I PRATI\" DI GIOVANNA MONAMI S.A.S." ;
    schema:alternateName "ERBORISTERIA I PRATI", "I PRATI", "I PRATI DI GIOVANNA MONAMI" ;
    schema:telephone "063700061" ;
    schema:email "INFO@IPRATI.IT" ;
    schema:address ex:org1_address1;
    schema:geo <geo:41.914,12.464163>;
.

schema:PostalAddress

Captures a contact point with a postal address

  • schema:description with cardinality = 1 as normalizzed string from template "DUF DUG, CIVIC, ZIP LOCALITY", es "LUNGOLARIO CESARE BATTISTI, 5, 23900 LECCO LC" )
  • schema:addressCountry with cardinality = 1, Country in two-letter ISO 3166-1 alpha-2 country code no language specs
  • schema:addressLocality with cardinality <= 1, The locality as normalized string. For example, "MILANO". Sholud be present in an official country adminstrative db as SKOS:primaryName or rdfs:label
  • schema:addressRegion with cardinality <= 1, The second administrative level as normalized string. For example, "MI". . Sholud be present in country adminstrative db as SKOS:primaryName
  • schema:streetAddress with cardinality <= 1, a normalizzed string from template "DUF DUG, CIVIC". For example, "VIA ANTONIO MORDINI, 3"
  • schema:postalCode with cardinality <= 1, Text The postal code. For example, 94043.

Example (in rdf turtle):

ex:org1_address1 a schema:PostalAddress ;   
    schema:alternateName 
        "VIA ANTONIO MORDINI, 3, 00195 ROMA RM"",
        "VIA ANTONIO MORDINI, 3 - ROMA";
    schema:addressCountry "IT";
    schema:addressLocality "ROMA";
    schema:streetAddress "VIA ANTONIO MORDINI, 3";
    schema:addressRegion "RM";
    schema:postalCode "00195";
.

schema:GeoCoordinates

Captures the center of a geographic location that is related with a place (not with an postal address)

The geo uri SHOULD be formatted according rfc 5870 Following properties/annotations supported:

  • wgs:lat with cardinality = 1,
  • wgs:long with cardinality = 1

Both lat and long shold be conformant to following regexp: ^-?([1-8]?[0-9].{1}\d{1,20}$|90.{1}0{1,20}$)

Example (in rdf turtle):

<geo:41.914,12.464163> a schema:GeoCoordinates ;
    wgs:lat 41.914 ;
    wgs:long 12.464163 ;
.

owl:Thing

Following properties/annotations supported for all object:

  • foaf:homepage strictly as Inverse Functional Property
  • foaf:page a web page related to the resource
  • dct:identifier an uniqe identifier in the context of the subject namespace.
  • owl:sameAs URL of a reference Web page that unambiguously indicates the item's identity.

Example (in rdf turtle):

    ex:org1_address owl:sameAs ex2:org2_address .
.

Data trust

Trust in data can be expressed according with the Dataset Quality Vocabulary (daQ). Quality observation can be associated to object or reficated statements :

Example (in rdf turtle):

    # trust level about an individual
    ex:obs1 a qb:Observation ;
        daq:computedOn ex:localbusines_1 ;
        dct:date "2014-01-23T14:53:01"^^xsd:dateTime ;
        daq:value "1.0"^^xsd:double ;
        daq:metric botk:trustMetric ;
        daq:computedBy [ foaf:homepage <http://linkeddata.center> ] ;
        daq:isEstimated false .

    # trust level about a statement     
    ex:obs2 a qb:Observation ;
        daq:computedOn [
            a rdf:Statement;
            rdf:subject ex:org1_address;
            rdf:predicate owl:sameAs;
            rdf:object ex2:org2_address;
        ];
        daq:value "0.6"^^xsd:double ;
        daq:metric kees:trustMetric ;
        daq:isEstimated true .
.

Reasoning requrement

Following properties/entities should be (at least partially) supported in BOTK reasoning:

  • owl:sameAs
  • owl:FunctionalProperty
  • owl:InverseFunctionalProperty
  • rdfs:subClassOf

License

Copyright © 2017 by Enrico Fagnoni at LinkedData.Center®

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.