Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hadyelsahar/944b4b32cd8b5216ee9d2186a7677a2e to your computer and use it in GitHub Desktop.
Save hadyelsahar/944b4b32cd8b5216ee9d2186a7677a2e to your computer and use it in GitHub Desktop.
@prefix ann: <http://triplr.dbpedia.org/resource/> .
@prefix wd: <http://www.wikidata.org/entity/> .
@prefix wdt: < http://www.wikidata.org/prop/direct/> .
#### MAIN PARAGRAPHS #####
wd:Q228?nif=context # repeated for every document (Q228 is the document.pageuri)
nif:beginIndex "0"^^xsd:nonNegativeInteger ;
nif:endIndex "1306"^^xsd:nonNegativeInteger ;
# make sure it's skipped
nif:isString """Andorra (/ænˈdɔːrə/; [ənˈdorə], [anˈdɔra]), officially the Principality of Andorra (Catalan: Principat d'Andorra), also called the Principality of the Valleys of Andorra (Catalan: Principat de les Valls d'Andorra), is a sovereign landlocked microstate in Southwestern Europe, located in the eastern Pyrenees mountains and bordered by Spain and France. Created under a charter in A.D. 988, the present Principality was formed in A.D. 1278. It is known as a principality as it is a monarchy headed by two Co-Princes – the Spanish/Roman Catholic Bishop of Urgell and the President of France. Andorra is the sixth-smallest nation in Europe, having an area of 468 km2 (181 sq mi) and a population of approximately 85,000. Its capital Andorra la Vella is the highest capital city in Europe, at an elevation of 1,023 metres (3,356 ft) above sea level. The official language is Catalan, although Spanish, Portuguese, and French are also commonly spoken. Andorra's tourism services an estimated 10.2 million visitors annually. It is not a member of the European Union, but the Euro is the de facto currency. It has been a member of the United Nations since 1993. In 2013, the people of Andorra had the highest life expectancy in the world at 81 years, according to The Lancet. Andorra entered service at 1970-01-22. """;
nif:predLang <http://lexvo.org/id/iso639-3/eng> ; # the language -- keep it as it is
a nif:Context . # all documents are having a type "nif:context"
######## TRIPLES ALIGNED #############
# First you state the triple:
# Triple 1 :
ann:0 a nif:AnnotationUnit ; ## state it's an annotation unit and give it a number
nif:subject wd:Q228 ; ## state the subject
nif:predicate wdt:P47 ; ## state the predicate
nif:object wd:Q7026 ; ## state the object
rdfs:comment "SPOALigner" .
######## Entities per Triple ############
# Text occurrence of Subject Triple 1
wd:Q225?nif=phrase&char=0,7 # Q225 is the page.uri not the entity being annotated
# link to annotation Unit
nif:annotationUnit ann:annotation0 ; # means associated to Annotation 0 (triple 1)
nif:anchorOf "Andorra" ;
nif:beginIndex "0"^^xsd:nonNegativeInteger ;
nif:endIndex "7"^^xsd:nonNegativeInteger ;
nif:referenceContext wd:Q228?nif=context ; # the context is the document where this was mentioned
itsrdf:taIdentRef wd:Q225; # The entity URI \0/
a nif:Phrase ;
rdfs:comment "SPOALigner" .
# Text occurrence of predicate Triple 1
wd:Q225?nif=phrase&char=x,y # Q225 is the page.uri not the entity being annotated # replace x and y with actual places
# link to annotation Unit
nif:annotationUnit ann:annotation0 ; # this means associated to Annotation 0 (triple 1)
nif:anchorOf "Born in" ; # remove if not possible (not SPO)
nif:beginIndex "x"^^xsd:nonNegativeInteger ; # remove if not possible (not SPO)
nif:endIndex "y"^^xsd:nonNegativeInteger ; # remove if not possible (not SPO)
nif:referenceContext wd:Q228?nif=context ; # the context is the document where this was mentioned
itsrdf:taIdentRef wdt:P37; # The entity URI \0/
a nif:Phrase ;
rdfs:comment "SPOALigner" .
## object same as Subject
@@ i think you go the idea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment