syn-func.sh

来自「jena2.5.4推理机系统的一种最基本实现 HP实验室出品」· Shell 代码 · 共 88 行

SH
88
字号
#!/bin/bash# Functions in support of syntax tests# Source this file.declare -a GOODGOOD_N=0declare -a BADBAD_N=0function fname{    local BASE="$1"	# Base    local N="$2"	# Number    local EXT="$3"	# Extension    [ "$EXT" = "" ] && EXT="rq"    echo $(printf "$BASE%02d.$EXT" $N)}# reads from stdinfunction testGood{    local FN="$1"    local I=${#GOOD[*]}    GOOD[$I]=$FN    cat > $FN}# reads from stdinfunction testBad{    local FN="$1"    local I=${#BAD[*]}    BAD[$I]=$FN    cat > $FN}function clean{    rm -f *.rq    rm -f *.arq    rm -f *.ttl}function createManifest{    local LABEL="$1"## Header    cat > manifest.ttl <<EOF@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .@prefix mf:     <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .@prefix mfx:    <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .@prefix qt:     <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .<>  rdf:type mf:Manifest ;    rdfs:comment "Syntax tests $LABEL" ;    mf:entries    ( EOF    # Queries good syntax    for f in "${GOOD[@]}"      do      cat >> manifest.ttl <<EOF      [  mf:name    "$f" ;         rdf:type   mfx:TestSyntax ;         mf:action  <$f> ;       ]EOF    done    # Queries - bad syntax    for f in "${BAD[@]}"      do      cat >> manifest.ttl <<EOF      [  mf:name    "$f" ;         rdf:type   mfx:TestBadSyntax ;         mf:action  <$f> ;       ]EOF    done## Trailer    cat >> manifest.ttl <<EOF    ) .EOF}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?