Display Results in RDF Format

Alternatively to the JSON format that we have seen in the examples before, the Extractor can also return the extraction results in RDF format.

The method for this is called 'annotate'. Compared to the extract method it has one required parameter more which is 'documentUri'. This is the URI the document will receive in the generated RDF data. A further parameter that we use here is 'displayText' so that the text that is provided as input is returned as part of the result.

One important detail that is not visible in the URL of the method call is the 'accept' header, as shown below. This header specifies the RDF serialisation format that the result should be returned in. For the example below we have set the header to 'text/turtle' and therefore the result is produced in Turtle format.

To get the results in a different RDF serialisation, change the 'accept' header accordingly.

Request

{{url}}/extractor/api/annotate?documentUri=http://example.com/demo&text=Shake the gin, orange juice and lime juice in a cocktail shaker with ice. Strain the contents of the shaker into and ice-filled highball or Collins glass. Slowly add the ginger ale, and gently stir. Garnish with the orange slice, and serve.&projectId={{project}}&showMatchingDetails=true&showMatchingPosition=true&numberOfTerms=0&displayText=true

The structure of the RDF that is produced can be seen in this result.

You find here the document with the URI <http://example.com/demo> with the creation date, the text of the document, the concept annotations and the configuration that was used for the extraction.The annotation entities contain the frequencies and the scores and the link to the concepts from the thesaurus:

Click to expand the result:

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix gn: <http://www.geonames.org/ontology#> .
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix ppx: <http://schema.semantic-web.at/ppx/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/demo> dcterms:created "2019-01-07T16:14:49.341+01:00"^^xsd:dateTime;
  dcterms:description "Shake the gin, orange juice and lime juice in a cocktail shaker with ice. Strain the contents of the shaker into and ice-filled highball or Collins glass. Slowly add the ginger ale, and gently stir. Garnish with the orange slice, and serve.";
  ppx:annotationConfiguration <http://schema.semantic-web.at/ppx/configuration/9fe80b1e-0b42-4008-9aea-c7b3840b8058>;
  ppx:conceptAnnotation <http://schema.semantic-web.at/ppx/ConceptAnnotation/5837358d-b621-41b6-878c-fb94ddf0bde7>,
    <http://schema.semantic-web.at/ppx/ConceptAnnotation/904782fb-ecdf-498b-8af2-1a4ac8796f0f>,
    <http://schema.semantic-web.at/ppx/ConceptAnnotation/e4af3f3f-363f-40a3-82b5-cb1b3b598a7b>,
    <http://schema.semantic-web.at/ppx/ConceptAnnotation/fc8e766d-e2fe-4698-824c-8fb4cf424cbb> .

<http://schema.semantic-web.at/ppx/configuration/9fe80b1e-0b42-4008-9aea-c7b3840b8058>
  a ppx:Configuration;
  ppx:categorizationBoost false;
  ppx:categorize false;
  ppx:disambiguate false;
  ppx:displayText true;
  ppx:filterNestedConcepts true;
  ppx:findPersonNames false;
  ppx:language "en";
  ppx:lemmatization true;
  ppx:locationExtraction false;
  ppx:numberOfConcepts 25;
  ppx:numberOfTerms 0;
  ppx:projectId "[1E034541-9963-0001-EE48-B5D068201D43]";
  ppx:sentimentAnalysis false;
  ppx:showMatchingDetails true;
  ppx:showMatchingPosition true;
  ppx:tfidfScoring false;
  ppx:useRelatedConcepts false;
  ppx:useTransitiveBroaderConcepts false;
  ppx:useTransitiveBroaderTopConcepts false;
  ppx:useTypes false;
  ppx:version "7.0.1-RC2" .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/e4af3f3f-363f-40a3-82b5-cb1b3b598a7b>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/5d96c50c-ee48-4c40-bb4c-4b9a42d11de6>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/53951158-3702-48de-a9b7-734bc24d910f>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 1.0E2 .

<http://schema.semantic-web.at/ppx/Label/53951158-3702-48de-a9b7-734bc24d910f> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/d9fb71f8-9806-4d33-b776-055e2b19339a>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Gin" .

<http://schema.semantic-web.at/ppx/Text/d9fb71f8-9806-4d33-b776-055e2b19339a> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/6cc79fcf-ebaf-42df-9f74-7b4b4cddc4ff>;
  <http://www.w3.org/2000/01/rdf-schema#label> "gin" .

<http://schema.semantic-web.at/ppx/MatchingPosition/6cc79fcf-ebaf-42df-9f74-7b4b4cddc4ff>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 10;
  nif:endIndex 12;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/5d96c50c-ee48-4c40-bb4c-4b9a42d11de6>
  a skos:Concept;
  skos:altLabel "Blue ruin"@en, "Gins"@en, "Mothers ruin"@en;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e>;
  skos:prefLabel "Gin"@en .

<https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e>
  a skos:ConceptScheme;
  dcterms:title "Beverages" .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/5837358d-b621-41b6-878c-fb94ddf0bde7>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/2ce50273-13b2-4ba1-9ff2-8cfbd835c1f2>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/8680bc1f-ed45-4f98-b8dd-3da524fc4038>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 9.6E1 .

<http://schema.semantic-web.at/ppx/Label/8680bc1f-ed45-4f98-b8dd-3da524fc4038> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/bde282d1-c4b9-40f5-986f-cb9048ab5a50>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Orange juice" .

<http://schema.semantic-web.at/ppx/Text/bde282d1-c4b9-40f5-986f-cb9048ab5a50> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/a3e60be0-7ff5-4902-991d-8892922119da>;
  <http://www.w3.org/2000/01/rdf-schema#label> "orange juice" .

<http://schema.semantic-web.at/ppx/MatchingPosition/a3e60be0-7ff5-4902-991d-8892922119da>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 15;
  nif:endIndex 26;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/2ce50273-13b2-4ba1-9ff2-8cfbd835c1f2>
  a skos:Concept;
  skos:altLabel "FCOJ"@en, "Just Juice"@en, "Not From Concentrate"@en, "Virgin Screwdriver"@en;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e>;
  skos:prefLabel "Orange juice"@en .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/904782fb-ecdf-498b-8af2-1a4ac8796f0f>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/88f5de3d-3de4-4a2f-9523-50bc7bb06600>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/e0eebbb5-d42c-4571-a32a-e752480c3b5b>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 8.5E1 .

<http://schema.semantic-web.at/ppx/Label/e0eebbb5-d42c-4571-a32a-e752480c3b5b> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/be9848f9-01c1-478b-9870-028fd297d961>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Lime juice" .

<http://schema.semantic-web.at/ppx/Text/be9848f9-01c1-478b-9870-028fd297d961> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/743e0d50-89b6-4b32-9461-5f59a16bd697>;
  <http://www.w3.org/2000/01/rdf-schema#label> "lime juice" .

<http://schema.semantic-web.at/ppx/MatchingPosition/743e0d50-89b6-4b32-9461-5f59a16bd697>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 32;
  nif:endIndex 41;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/88f5de3d-3de4-4a2f-9523-50bc7bb06600>
  a skos:Concept;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e>;
  skos:prefLabel "Lime juice"@en .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/fc8e766d-e2fe-4698-824c-8fb4cf424cbb>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/20d288cb-4e38-46f9-9bec-1c79d8397215>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/1c61595f-e030-4a21-807c-819466a7359e>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 3.3E1 .

<http://schema.semantic-web.at/ppx/Label/1c61595f-e030-4a21-807c-819466a7359e> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/875797f0-4bf7-4c97-8ea6-d37c660e0428>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Collins glass" .

<http://schema.semantic-web.at/ppx/Text/875797f0-4bf7-4c97-8ea6-d37c660e0428> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/07a9114c-cbcb-4f30-b95c-e5adc7d4bea1>;
  <http://www.w3.org/2000/01/rdf-schema#label> "collins glass" .

<http://schema.semantic-web.at/ppx/MatchingPosition/07a9114c-cbcb-4f30-b95c-e5adc7d4bea1>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 140;
  nif:endIndex 152;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/20d288cb-4e38-46f9-9bec-1c79d8397215>
  a skos:Concept;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/f09732a9-a0e6-494a-8ce9-299ef036aaaf>;
  skos:prefLabel "Collins glass"@en .

<https://nextrelease-cons.semantic-web.at/cocktails/f09732a9-a0e6-494a-8ce9-299ef036aaaf>
  a skos:ConceptScheme;
  dcterms:title "Glassware" .

<http://example.com/demo> ppx:conceptAnnotation <http://schema.semantic-web.at/ppx/ConceptAnnotation/1b3fe640-8942-4a2c-8f2d-0392ca783c81>,
    <http://schema.semantic-web.at/ppx/ConceptAnnotation/a4c0ffdb-a439-45fa-b4b6-24fb77d752b8> .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/1b3fe640-8942-4a2c-8f2d-0392ca783c81>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/89ac12aa-d4f9-46d0-b127-fd8f4c21fbcc>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/03ce3f7e-aadf-4172-83a8-af3c48ceb471>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 2.3E1 .

<http://schema.semantic-web.at/ppx/Label/03ce3f7e-aadf-4172-83a8-af3c48ceb471> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/1152d75a-7589-4a10-b7f3-20fecdc97b22>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Ginger ale" .

<http://schema.semantic-web.at/ppx/Text/1152d75a-7589-4a10-b7f3-20fecdc97b22> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/37a3da68-c2c0-462a-b19e-7b769b270237>;
  <http://www.w3.org/2000/01/rdf-schema#label> "ginger ale" .

<http://schema.semantic-web.at/ppx/MatchingPosition/37a3da68-c2c0-462a-b19e-7b769b270237>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 170;
  nif:endIndex 179;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/89ac12aa-d4f9-46d0-b127-fd8f4c21fbcc>
  a skos:Concept;
  skos:altLabel "Gingerale"@en;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e>;
  skos:prefLabel "Ginger ale"@en .

<http://schema.semantic-web.at/ppx/ConceptAnnotation/a4c0ffdb-a439-45fa-b4b6-24fb77d752b8>
  a ppx:ConceptAnnotation;
  ppx:extractedConcept <https://nextrelease-cons.semantic-web.at/cocktails/99171f20-c59f-40c4-998a-a9c8f1909168>;
  ppx:frequency 1;
  ppx:matchingLabel <http://schema.semantic-web.at/ppx/Label/2d44b78f-7e0c-4dc1-9994-d165579aedbe>;
  ppx:referenceThesaurus "1E034541-9963-0001-EE48-B5D068201D43";
  ppx:score 1.2E1 .

<http://schema.semantic-web.at/ppx/Label/2d44b78f-7e0c-4dc1-9994-d165579aedbe> a ppx:Label;
  ppx:frequency 1;
  ppx:labelProvenance skos:altLabel;
  ppx:matchedText <http://schema.semantic-web.at/ppx/Text/35df3519-d3e1-4884-85d2-ec932aeca57d>;
  <http://www.w3.org/2000/01/rdf-schema#label> "Orange" .

<http://schema.semantic-web.at/ppx/Text/35df3519-d3e1-4884-85d2-ec932aeca57d> a ppx:Text;
  ppx:frequency 1;
  ppx:matchingPosition <http://schema.semantic-web.at/ppx/MatchingPosition/c7d52a66-d29e-4817-98f7-11fd0adb496a>;
  <http://www.w3.org/2000/01/rdf-schema#label> "orange" .

<http://schema.semantic-web.at/ppx/MatchingPosition/c7d52a66-d29e-4817-98f7-11fd0adb496a>
  a nif:Phrase, ppx:MatchingPosition;
  nif:beginIndex 216;
  nif:endIndex 221;
  nif:referenceContext <http://example.com/demo> .

<https://nextrelease-cons.semantic-web.at/cocktails/99171f20-c59f-40c4-998a-a9c8f1909168>
  a skos:Concept;
  skos:altLabel "Appelsina"@en, "Appelsína"@en, "Citrus sinensis"@en, "Citrus x sinensis"@en,
    "Citrus × sinensis"@en, "Citrus ×sinensis"@en, "Culture of orange"@en, "Navel Orange"@en,
    "Navel orange"@en, "Orange (botany)"@en, "Orange (flavor)"@en, "Orange (plant)"@en,
    "Orange (tree)"@en, "Orange fruit"@en, "Orange tree"@en, "Orange trees"@en, "Orange wood"@en,
    "Orange(fruit)"@en, "Orangewood"@en, "Sweet Orange"@en, "Sweet orange"@en, "Sweet oranges"@en;
  skos:inScheme <https://nextrelease-cons.semantic-web.at/cocktails/eff672ac-6601-42c6-a3e9-0adda3b45df8>;
  skos:prefLabel "Orange"@en .

<https://nextrelease-cons.semantic-web.at/cocktails/eff672ac-6601-42c6-a3e9-0adda3b45df8>
  a skos:ConceptScheme;
  dcterms:title "Garnish and other ingredients" .