Dear List, first, I would like to introduce myself: I am an IT teacher and long time IT consultant from Germany who has been using geany as an IDE for Java and Markdown on (X)Ubuntu for some time. My experience with respect to geany developing is mostly in file formats (plus some C++ knowledge - coming from Java, Python, and plain C). So, I think I'll be more active on the lexer (-> Scintilla) side than on the geany GUI side.
Now, I created a custom config file that I'd like to share for the RDF Turtle description language (https://www.w3.org/TR/turtle/), which is being used in the context of the Semantic Web. The config is based on the Scintilla Python lexer which does most things correctly. I added custom compile and link commands for syntax check and creating a GraphViz input employing two external packages (Can anybody bring light into how the error regex is supposed to work?). I'm including this filetype.RDF-Turtle.conf for someone to put it on the geany wiki (I would be willing to do so if I knew how). I called it RDF-Turtle in order not to create confusion with the Turtle beginner's programming language. The attachment rdf-turtle-example.ttf is an example file to show the kind of syntax Turtle uses. (It does not make any practical sense in terms of its contents but it shows the relevant Turtle features.) I also added some Turtle support to snippets.conf see attached snippets.RDF-Turtle.conf. There is a variant (with respect to syntax highlighting and editing) of RDF Turtle that is called N-Triples (https://www.w3.org/TR/n-triples/) which uses another mimetype so IMHO needs an other filetypes.RDF-NTriples.conf which I also include. The Turtle snippets can be used for N-Triples as well. Best Regards, Hans-Peter Ederberg
## RDF Turtle (https://www.w3.org/TR/turtle) notation filetype ## by H-P Ederberg ## June 11, 2020 ## (c) CC-BY-SA 3.0 ## ## (almost) correctly highlights all examples from TR: ## RDF IRIs containig '#' chars are not properly highlighted # For complete documentation of this file, please see Geany's main documentation [styling] # these specify highlighting for "primary"=word and "identifier"=word2 word=keyword_1 word2=keyword_2 # Python lexer sees @prefix and @base as decorator, should be shown like word2 decorator=keyword_2 # these types are built into the Python lexer default=default number=number,bold # Python lexer uses C(++) isoperator(char) function, not configurable operator=keyword_2,bold # always from '#' to EOL - interferes w/ some IRIs commentline=comment_line # double '##' are treated like '#' by Turtle # we use a modified font-style to allow special attention comments commentblock=comment_line,bold # Python lexer distiguishes between "string" and 'char', Turtle does not string=string character=string triple=string tripledouble=string # all unquoted text should have default highlighting identifier=default # these are irrelevant in turtle files so we use default highlighting classname=default defname=default stringeol=default fstring=default fcharacter=default ftriple=default ftripledouble=default [keywords] # boolean constants, common schema prefixes (xsd,owl,dc,rdf,rdfs), plus their data types and classes primary=true false xsd string integer boolean decimal double Id ID owl AllDifferent AllDisjointClasses AllDisjointProperties Annotation AnnotationProperty AsymmetricProperty Axiom Class DataRange DatatypeProperty DeprecatedClass DeprecatedProperty FunctionalProperty InverseFunctionalProperty IrreflexiveProperty NamedIndividual NegativePropertyAssertion Nothing ObjectProperty Ontology OntologyProperty ReflexiveProperty Restriction SymmetricProperty TransitiveProperty Thing allValuesFrom annotatedProperty annotatedSource annotatedTarget assertionProperty backwardCompatibleWith bottomDataProperty bottomObjectProperty cardinality complementOf datatypeComplementOf deprecated differentFrom disjointUnionOf disjointWith distinctMembers equivalentClass equivalentProperty hasKey hasSelf hasValue imports incompatibleWith intersectionOf inverseOf maxCardinality maxQualifiedCardinality members minCardinality minQualifiedCardinality onClass onDataRange onDatatype oneOf onProperties onProperty priorVersion propertyChainAxiom propertyDisjointWith qualifiedCardinality sameAs someValuesFrom sourceIndividual targetIndividual targetValue topDataProperty topObjectProperty unionOf versionInfo versionIRI withRestrictions dc abstract accessRights accrualMethod accrualPeriodicity accrualPolicy alternative audience available bibliographicCitation conformsTo contributor coverage created creator date dateAccepted dateCopyrighted dateSubmitted description educationLevel extent format hasFormat hasPart hasVersion identifier instructionalMethod isFormatOf isPartOf isReferencedBy isReplacedBy isRequiredBy issued isVersionOf language license mediator medium modified provenance publisher references relation replaces requires rights rightsHolder source spatial subject tableOfContents temporal title type valid contributor coverage creator date description format identifier language publisher relation rights source subject title type Agent AgentClass BibliographicResource FileFormat Frequency Jurisdiction LicenseDocument LinguisticSystem Location LocationPeriodOrJurisdiction MediaType MediaTypeOrExtent MethodOfAccrual MethodOfInstruction PeriodOfTime PhysicalMedium PhysicalResource Policy ProvenanceStatement RightsStatement SizeOrDuration Standard Collection Dataset Event Image InteractiveResource MovingImage PhysicalObject Service Software Sound StillImage Text domainIncludes memberOf rangeIncludes VocabularyEncodingScheme rdfs Class Resource subClassOf subPropertyOf comment label domain range seeAlso isDefinedBy Container ContainerMembershipProperty member Literal Property Datatype rdf HTML langString PlainLiteral JSON XMLLiteral type Literal Property Statement subject predicate object Bag Seq Alt value List nil first rest CompoundLiteral language direction # the basic turtle keywords and the ISO 639-1 language codes (for language specific strings) identifiers=_ a @prefix PREFIX @base BASE @ aa ab ae af ak am an ar as av ay az ba be bg bh bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg sh si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh zh # operators recognized by RDF Turtle # list is not used by lexer, included for reference #operators=: ; . ^^ , ( ) [ ] [lexer_properties] # switch off python things we do not need in rdf-turtle # dont check indentation levels, binary number formats, special string formats tab.timmy.whinge.level=0 lexer.python.literals.binary=0 lexer.python.strings.u=0 lexer.python.strings.b=0 lexer.python.strings.f=0 # accept multiline strings and allow folding lexer.python.strings.over.newline=1 fold.quotes.python=1 [settings] # these are used by geany itself # default extension used when saving files extension=ttl # MIME type mime_type=text/turtle # Python lexer has definable keywords and a suitable base syntax lexer_filetype=Python # the following characters are these which a "word" can contain, see documentation # extended to include all IRI components wordchars=<>/:.@?#_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # single comments, like # in this file comment_single=# # multiline comments ## not allowed in RDF Turtle #comment_open=< #comment_close=> # set to false if a comment character/string should start at column 0 of a line, true uses any # indentation of the line, e.g. setting to true causes the following on pressing CTRL+d #command_example(); # setting to false would generate this # command_example(); # This setting works only for single line comments comment_use_indent=false # context action command (please see Geany's main documentation for details) # try to open/search URL on Ubuntu context_action_cmd=exo-open --launch WebBrowser "%s" # if this setting is set to true, a new line after a line ending with an # unclosed tag will be automatically indented xml_indent_tags=false [indentation] #width=4 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=1 [build-menu] # GraphViz Visualisation using raptor library # packages see http://librdf.org/raptor/ FT_00_LB=Create _GraphViz DOT FT_00_CM=rapper -i turtle -o dot %f > %e.gv FT_00_WD=%d # turtle syntax checker from 'npm -install turtle-validator' # see https://github.com/IDLabResearch/TurtleValidator # ttl itself always exits successfully, therefore checking output w/ awk FT_01_LB=_Validate FT_01_CM=ttl %f | awk '{print}/ 0 errors/{OK=1}END{exit 1-OK}' FT_01_WD=%d
[styling=RDF-Turtle] decorator=default # does not allow @ [keywords] # N-Triples uses fewer keywords primary=true false xsd string integer boolean decimal double Id ID nil first rest identifiers=_ a aa ab ae af ak am an ar as av ay az ba be bg bh bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg sh si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh zh [lexer-properties=RDF-Turtle] [settings=RDF-Turtle] # default extension used when saving files extension=nt # MIME type mime-type=application/n-triples [indentation=RDF-Turtle] [build-menu=RDF-Turtle]
# Examples from RDF Turtle Recommendation at https://www.w3.org/TR/turtle/ # show highlighting an selected examples covering most of Turtle ## Example 9 # A triple with all absolute IRIs <http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> . @base <http://one.example/> . <subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2 BASE <http://one.example/> <subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2 @prefix p: <http://two.example/> . p:subject3 p:predicate3 p:object3 . # prefixed name, e.g. http://two.example/subject3 PREFIX p: <http://two.example/> p:subject3 p:predicate3 p:object3 . # prefixed name, e.g. http://two.example/subject3 @prefix p: <path/> . # prefix p: now stands for http://one.example/path/ p:subject4 p:predicate4 p:object4 . # prefixed name, e.g. http://one.example/path/subject4 @prefix : <http://another.example/> . # empty prefix :subject5 :predicate5 :object5 . # prefixed name, e.g. http://another.example/subject5 :subject6 a :subject7 . # same as :subject6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :subject7 . <http://伝言.example/?user=أكرم&channel=R%26D> a :subject8 . # a multi-script subject IRI . ## Example 11 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix show: <http://example.org/vocab/show/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . show:218 rdfs:label "That Seventies Show"^^xsd:string . # literal with XML Schema string datatype show:218 rdfs:label "That Seventies Show"^^<http://www.w3.org/2001/XMLSchema#string> . # same as above show:218 rdfs:label "That Seventies Show" . # same again show:218 show:localName "That Seventies Show"@en . # literal with a language tag show:218 show:localName 'Cette Série des Années Soixante-dix'@fr . # literal delimited by single quote show:218 show:localName "Cette Série des Années Septante"@fr-be . # literal with a region subtag show:218 show:blurb '''This is a multi-line # literal with embedded new lines and quotes literal with many quotes (""""") and up to two sequential apostrophes ('').''' . ## Example 23 @prefix : <http://example.org/stuff/1.0/> . (1 2.0 3E1) :p "w" . # Example 24 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . _:b0 rdf:first 1 ; rdf:rest _:b1 . _:b1 rdf:first 2.0 ; rdf:rest _:b2 . _:b2 rdf:first 3E1 ; rdf:rest rdf:nil . _:b0 :p "w" . ## Example 25 PREFIX : <http://example.org/stuff/1.0/> (1 [:p :q] ( 2 ) ) :p2 :q2 . # Example 26 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . _:b0 rdf:first 1 ; rdf:rest _:b1 . _:b1 rdf:first _:b2 . _:b2 :p :q . _:b1 rdf:rest _:b3 . _:b3 rdf:first _:b4 . _:b4 rdf:first 2 ; rdf:rest rdf:nil . _:b3 rdf:rest rdf:nil . ## Example 27 @prefix ericFoaf: <http://www.w3.org/People/Eric/ericP-foaf.rdf#> . @prefix : <http://xmlns.com/foaf/0.1/> . ericFoaf:ericP :givenName "Eric" ; :knows <http://norman.walsh.name/knows/who/dan-brickley> , [ :mbox <mailto:ti...@w3.org> ] , <http://getopenid.com/amyvdh> .
# RDF-Turtle and NTriples sections for geany snippets.conf [RDF-Turtle] rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>:%cursor% rdfs=<http://www.w3.org/2000/01/rdf-schema#>:%cursor% xsd=<http://www.w3.org/2001/XMLSchema#>:%cursor% owl=<http://www.w3.org/2002/07/owl#>:%cursor% dc=<http://purl.org/dc/elements/1.1/>:%cursor% ht=<http://%cursor%> [RDF-NTriples] rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>:%cursor% rdfs=<http://www.w3.org/2000/01/rdf-schema#>:%cursor% xsd=<http://www.w3.org/2001/XMLSchema#>:%cursor% owl=<http://www.w3.org/2002/07/owl#>:%cursor% dc=<http://purl.org/dc/elements/1.1/>:%cursor% ht=<http://%cursor%>
_______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel